Professional Documents
Culture Documents
Homework 5
Homework 5
Homework 5
Summary:
In this assignment you will calculate the beta coefficient of a stock(s) using different
methods in Python. You are free to use any library and data container.
Homework Instructions:
2. Compute the beta coefficient for the stock(s) using the following methods:
𝐶𝑜𝑣(𝑟𝐹 ,𝑟𝑆𝑃500 )
a. Using the mathematical function: 𝛽𝐹,𝑆𝑃500 =
𝑉𝑎𝑟(𝑟𝐹 )
b. Using the matrix/vector method of OLS (See eq. (12)): (𝑟𝐹𝑇 · 𝑟𝐹 )−1 · 𝑟𝐹𝑇 · 𝑟𝑆𝑃500
c. Using the linear regression package in SciPy
3. Plot 𝑟𝑡,𝑖 and 𝑟𝑡,𝑆𝑃500 , with the x-axis set to time and the x-label set to years.
Grading Process
I will award points according the rubric in the syllabus. To determine whether the script
is correct and efficient, the program will be run on a separate stock-day file. The script, if
done correctly, will report accurate results for a random stock day file.
If you are unable to complete all the tasks above, at a minimum make sure your script can
run and produce some output. A script that doesn’t run receives the least amount of points.