/Python-CAPM_model_regressions

Code to Run CAPM model for two stocks and summerize regressions to predict market performance

Primary LanguageJupyter NotebookMIT LicenseMIT

Stock Performance and Relationship Analysis using CAPM

This program analyzes the performance of two stocks, BCS and ULVR, and their relationship with the market using the Capital Asset Pricing Model (CAPM). The program calculates the beta for each stock and runs the CAPM model to estimate their expected returns. It also conducts a regression analysis to examine the relationship between the stock returns and the market returns.

Getting Started

Prerequisites

To run this program, you need to have Python 3.x installed on your computer, along with the following Python libraries:

  • NumPy
  • Pandas
  • Statsmodels

Installation

You can install the required libraries using pip. Open your terminal and type the following commands:

pip install numpy
pip install pandas
pip install statsmodels

Usage

  1. Download or clone the repository to your computer.
  2. Navigate to the repository folder using your terminal.
  3. Place your data CSV file in the same folder as the program file.
  4. Open the program file in your preferred Python IDE or text editor.
  5. Modify the program variables to match your data CSV file columns.
  6. Run the program.

Program Breakdown

The program follows the following steps:

  1. Imports the necessary Python libraries: NumPy, Pandas, and Statsmodels.
  2. Loads the data CSV file using Pandas.
  3. Extracts the relevant variables from the data CSV file.
  4. Calculates the beta for each stock using NumPy.
  5. Runs the CAPM model to estimate the expected returns.
  6. Conducts a regression analysis using Statsmodels to examine the relationship between the stock returns and the market returns.
  7. Prints the summary of the regression results.
  8. Provides analysis and interpretation based on the regression results.

Conclusion

This program provides a basic analysis of the performance and relationship of two stocks with the market using the Capital Asset Pricing Model. However, further analysis and interpretation may be required for making investment decisions. Use this program as a starting point for your stock analysis and customize it according to your needs.