Stock price prediction is crucial in stock market research, yet existing models often overlook interdependencies among stocks in the same industry, treating them as independent entities. Recognizing and accounting for these interdependencies is essential for precise predictions. Propensity score matching (PSM), a statistical method for balancing individuals between groups and improving causal inferences, has not been extensively applied in stock interdependence investigations. Our study addresses this gap by introducing PSM to examine interdependence among pharmaceutical industry stocks for stock price prediction. Additionally, our research integrates Improved particle swarm optimization (IPSO) with long short-term memory (LSTM) networks to enhance parameter selection, improving overall predictive accuracy. The dataset includes price data for all pharmaceutical industry stocks in 2022, categorized into chemical pharmaceuticals, biopharmaceuticals, and traditional Chinese medicine. Using Stata, we identify significantly correlated stocks within each sub-industry through average treatment effect on the treated (ATT) values. Incorporating PSM, we match five target stocks per sub-industry with all stocks in their respective categories, merging target stock data with weighted data from non-target stocks for validation in the IPSO-LSTM model. Our findings demonstrate that including non-target stock data from the same sub-industry through PSM significantly improves predictive accuracy, highlighting its positive impact on stock price prediction. This study pioneers PSM’s use in studying stock interdependence, conducts an in-depth exploration of effects within the pharmaceutical industry, and applies the IPSO optimization algorithm to enhance LSTM network performance, providing a fresh perspective on stock price prediction research.