I am struggling to compute my out-of-sample results for R^2os. This is out-of-sample R^2 as done by Campbell and Thompson (2008), as
1 - sum[(r_t - rhat_t)^2] / sum[(r_t - rbar_t)^2] , where rhat is the fitted value from a predictive regression, rbar is the historical average return.
I have tried this code so far but my results do not match those I am trying to replicate.
My initial period is t<205 to forecast from t= 205 to 504.
regress r1 DPs if t<205
predict fittedDPs
gen feDPs = r1 - fittedDPs if t>=205
gen sfeDPs = feDPs^2
gen sumsfeDPs = sum(sfeDPs)
regress r1 if t<205
predict historic
gen fehist = r1 - historic if t>=205
gen sfehist = fehist^2
gen sumsfehist = sum(sfehist)
I then compare the last values at t=504 of the summed variables as the R^2os states as = 1 - sum[(r_t - rhat_t)^2] / sum[(r_t - rbar_t)^2]
so 1 - sumsfeDPs/sumsfehist, at t=504.
However I am not producing the correct results.
Any help would be greatly appreciated.
Related Posts with Out-of-sample R^2
plotting interaction for xtpoissonHi Statalist fellow, I have run an analysis but I don't trust my result. I would be extremely apprec…
Manipulating panel data based on previous time valuesHi, I am working with a district-year panel data set in which there are 10 years. I am interested i…
Differences in margins postestimation command for tpoisson relative to poissonI'm currently using a truncated poisson model with command tpoisson and ll(0) and ul(6) for a depend…
sex of the first born childhi stata user , I'm having trouble in generating sex of the first born child. can anyone help me ? …
Extract Std.Err. and 95% Conf. Interval after regressionHi Statalist After running a regression, I understand we can extract the estimated coefficients in …
Subscribe to:
Post Comments (Atom)
0 Response to Out-of-sample R^2
Post a Comment