* * Week 10 * * * *Load data, file -> import -> ASCII data created by spreadsheet * *insheet FTSE_BARC.csv.csv * rename v1 time rename v2 ftse100 rename v3 barc tsset time *Generate returns generate lrftse100 = log(ftse100 /L.ftse100) generate rftse100 = ftse100 /L.ftse100 -1 generate lrbarc = log(barc /L.barc) generate rbarc = barc /L.barc -1 *Checking graphs twoway (line ftse100 time) (line barc time, yaxis(2)) twoway (line lrbarc time) (line lrftse100 time, yaxis(2)) *Spurious regression example drawnorm error1 error2, n(1568) seed(1000) gen tempY = 0.05 + error1 gen tempX = 0.02 + error2 replace tempY = 0.05 + error1 + L.tempY in 2/1568 replace tempX = 0.02 + error2 + L.tempX in 2/1568 drop error1 error2 *False results, serial correlation invalidates results reg tempY tempX *Difference is stationary, results are good gen tempDiffY = (tempY - L.tempY) gen tempDiffX = (tempX - L.tempX) reg tempDiffY tempDiffX *Look for significantly negative values to reject Ho of unit root, nonstationarity. *Dickey–Fuller test for unit root. Determining the length of lag dfgls rbarc, ers dfgls rftse100, ers reg rbarc rftse100 *Breusch–Godfrey test for serial correlation. Look for high prob to state no serial correlation. * Formal definition: insufficient evidence to reject h0 of no serial correlation *If lag values included, lags is not 0 estat bgodfrey, lags(0) *Breusch–Pagan test for heteroskedasticity. Ho: homoskedasticity (High prob -> constant variance) estat hettest *Non-linear model, help arch - for more details *ARCH effects, testing if there is arch 1 effect estat archlm, lags(1) *check t values of added lags, if significant add more arch rbarc rftse100,arch(1/1) *Information criteria - to evaluate if the fit is better, smaller values indicate a better fit estat ic arch rbarc rftse100,arch(1/2) estat ic *Using robust against heteroskedasticity variance-covariance matrix reg rbarc rftse100,robust *Jarque - Berra test for normality. In this case testing the distribution of the error term. predict res, residuals histogram res, normal bin(50) su res, detail *Manual implementation, formula as below. *JarBer = (n/6)*((skew^2)+1/4(Kurt-3)^3) *Chi^2 distribution with 2 df to compare against critical value. *Ho residuals are normally distributed *Ramsey RESET test for misspecification. Testing against higher polynomial transformations. High F values -> reject Ho of correctly specified model ovtest **CAPM testint * Risk free rate assume: 2.5% annual return -> (1+0.025)^1/365 = 1.0001 *model: returnI - returnRiskFree = b(returnMarket - returnRiskFree) *Implies no constant gen erbarc = rbarc - 0.0001 gen erftse100 = rbarc - 0.0001 reg rbarc rftse100,robust *Can not reject Ho of CAPM being true test _cons == 0