With the rapid development of financial markets, accurate stock price prediction is significant to investors and financial institutions. Many researchers proposed stock price prediction models, including linear models, random forests, and LSTMs. However, few studies have comprehensively compared the three models. This study aims to fill this gap by analysing the forecasting effectiveness of different models through empirical studies. This research is to explore the application of linear models, random forests, and LSTM models in predicting stock prices and analyse and compare the principles, advantages and disadvantages, and the scope of application of these three models. According to the analysis, they all have their scope of application and limitations in different situations. In practical application, the appropriate model can be chosen for prediction and analysis according to the specific data sets and research purpose. Meanwhile, it is also possible to try to integrate and improve different models to get better prediction results. In addition, the influence of data quality and completeness, feature selection and extraction from the prediction results should be noted to improve the prediction accuracy and stability of the model. In conclusion, this thesis provides some references and lessons for related studies and practical applications by analysing and comparing the applications of LSTM, linear models, and random forests in predicting stock prices.