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
Estimate how long reshape should take.Is there a rough way to calculate how much time a reshape from wide to long should take, or what is …
Stata coding (DID, Event study and Triple differences)Hello! I am doing DID, Event study and Triple differences, but it is not easy for me to make the ri…
Bug in -svy: mean- ?I have a bit of code that looks like this: Code: qui { putexcel set test.xlsx, replace us…
Difficiculties with predicting GDPHi, I am writing my bachelor's thesis right now, and I am having difficulties with the predict comma…
Firthlogit, marginal effects and interactionsDear all, I tried to run a logit model with an interaction effect which unfortunately does not work…
Subscribe to:
Post Comments (Atom)
0 Response to prediction, unexpected results
Post a Comment