面板数据如下:
id month sale
01 1 1010
01 2 298
。
。
。
01 12 576
02 1 535
。。。
按id分组对sale进行预测,程序如下:
egen n=group(id)
sum n
local r=r(max)
gen fy=.
forv i=1/`r'{
arima sale if n==`i'
predict y if e(sample)
replace fy=y
drop y
}
得出的只有最后一组有预测值。是哪里编错了还是整体就不能这样编啊??