Quadratic trend for each country in the panel
Posted: Mon Mar 10, 2014 3:38 am
Dear Tom,
I do have a panel with 13 countries. I do want to calculate the output gap for each country individually.
I used the sample code from the user guide to do data transformations for each item.
It works fine for th HP-filtered output gap, but for the output gap constructed using the quadratic trend it just produces the output gaps for the last country in the panel. Also replacing the output gap from the j loop intop the i loop. Does not change the result.
Where is the mistake?
panel(group=cid,id=vid,identries=identries)
do i=1,%size(vid)
comp a=0
*loop for individuals
do j=1,%size(identries(i))
* loop over entries within individuals
compute it=identries(i)(j)
FILTER(TYPE=HP,TUNING=1600) GDPINDEX i//ibegin i//iend HP_GDP
set ygap =GDPindex-HP_GDP
comp a = a+1
comp trend(a+(i-1)*80) = a
comp trend2(a+(i-1)*80) = a*a
linreg gdpindex i//ibegin i//iend ygapsq
# constant trend trend2
end do j
end do i
Thanks a lot
Gilbril
I do have a panel with 13 countries. I do want to calculate the output gap for each country individually.
I used the sample code from the user guide to do data transformations for each item.
It works fine for th HP-filtered output gap, but for the output gap constructed using the quadratic trend it just produces the output gaps for the last country in the panel. Also replacing the output gap from the j loop intop the i loop. Does not change the result.
Where is the mistake?
panel(group=cid,id=vid,identries=identries)
do i=1,%size(vid)
comp a=0
*loop for individuals
do j=1,%size(identries(i))
* loop over entries within individuals
compute it=identries(i)(j)
FILTER(TYPE=HP,TUNING=1600) GDPINDEX i//ibegin i//iend HP_GDP
set ygap =GDPindex-HP_GDP
comp a = a+1
comp trend(a+(i-1)*80) = a
comp trend2(a+(i-1)*80) = a*a
linreg gdpindex i//ibegin i//iend ygapsq
# constant trend trend2
end do j
end do i
Thanks a lot
Gilbril