Skip to content

Instantly share code, notes, and snippets.

@ubaid960
Last active January 11, 2021 22:05
Show Gist options
  • Save ubaid960/471686e9c433ae256878abd6e2965d10 to your computer and use it in GitHub Desktop.
Save ubaid960/471686e9c433ae256878abd6e2965d10 to your computer and use it in GitHub Desktop.
Ubaid Sheikh
12/08/2020
** Final Project Do File
**Downloaded the S&P 500 data from Yahoo Finance
getsymbols AAPL ^GSPC, fy(2019) fm(9) yahoo
sum adjclose_AAPL volume_AAPL adjclose__GSPC volume__GSPC
scatter adjclose_AAPL daten
histogram adjclose_AAPL, normal
bro
gen time=_n
gen covid=0
replace covid=1 if time >105
**1st Initial regression
reg adjclose_AAPL volume_AAPL adjclose__GSPC volume__GSPC
**2nd Regression with lag variable and dummy variable
reg adjclose_AAPL volume_AAPL adjclose__GSPC volume__GSPC L.adjclose__GSPC covid
**check for skewness for possible transformation
tabstat adjclose_AAPL volume_AAPL adjclose__GSPC volume__GSPC, stats(sk)
**generate logs
gen log_adjclose_AAPL
gen log_volume_AAPL
gen log_volume__GSPC
**3rd new regression with log transformation
reg log_adjclose_AAPL log_volume_AAPL adjclose__GSPC log_volume__GSPC covid
**4th new regression with slope dummy
reg log_adjclose_AAPL log_volume_AAPL adjclose_AAPL log_volume__GSPC L.adjclose__GSPC covid covid#c.adjclose__GSPC
**get residuals and squared residuals
predict uhat,resid
gen uhat2=uhat^2
**dwatson test
estate dwatson
**Breusch-Godfrey test
reg uhat l.uhat l2.uhat adjclose_AAPL
@ubaid960
Copy link
Author

ubaid960 commented Jan 11, 2021

2020 S&P 500 stock market crash

This is the code for my project that uses stata to show how S&P 500 stock such Apple has been affected due to the covid-19 crisis. I performed regression analysis and used log transformational variable along with lag variable as well as a slope dummy variable such as covid. More so, I used time series methods such prediction function, dwatson test, Breusch-Godfrey test to check the results.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment