我需要预测回归的残差和拟合值,根据连老师和Sungmoo编的程序, 加入下几道程序(下面黑体部分),但系统提示:h already define. 请问高人怎办?用该程序如何得到拟合值?非常感谢!
egen g=group( year ind )
su g
loc n=r(max)
g e=.
g c=.
forv i=1/`n'{
reg sales MB cfo invest if g==`i'
predict r if e(sample),r
predict h if e(sample), hatreplace e=r if e(sample)
replace c=h if e(sample)
drop r c
}
drop g