Hi,
I run a prediction by the first 20 sample (y and x), and I would like to use the results to predict the 25th y_f (a special out of sample prediction). I think this is what I do in the programming, but it gives me the prediction for the 20th sample (in-sample). Why? How can I modify my program to obtain the out-of-sample (25th) prediction?
I have a loop, and I expect that it will give me prediction for 25th, 26th, 27th.
clear all
import excel "xyz1.xlsx", firstrow case(lower) clear
sca start_T = 20
sca n1 = 5
egen t1 = seq()
gen y_f = .
forvalues i = `=start_T'/`=start_T+2'{
reg y xa if t1<= `i' & t1> `i'-start_T // it works
predict temp in `i+n1'
replace y_f = temp in `i+n1'
drop temp
}
Thank you very much!!
Related Posts with prediction, unexpected results
Current timezoneI would like to know if it is possible to obtain the current timezone (offset in hours/minutes) of t…
Problem with Stata's parsing of command options in graphical commandsDear All, I suspect a bug in Stata's parsing of command options in graphical commands. Can someone c…
Homogeneity and symmetry condition in LA-AIDS in stata command suregDear community, I want to estimate LA-AIDS with homogeneity and symmetry conditions imposed. I have …
Putexcel: Conditional FormattingDear all, I need to generate an Excel report containing summary statistics as well as a subset of o…
how to report nagelkerke and index in logit regressionhow can I report nagelkerke and index for the model fit f in logit regresion? I tried fitstat after…
Subscribe to:
Post Comments (Atom)
0 Response to prediction, unexpected results
Post a Comment