Hi
I want to run the below code, but can't get it right.
As I have a panel data with many IDs and months. I want to run the univariate Garch model as "arch X, arch(1/1) garch(1/1)", but can't get the estimation as per ID, in the below loop. X is the only variable that I am considering.
Can someone help how to modify the above code to suit my requirements?
I want to run the below code, but can't get it right.
As I have a panel data with many IDs and months. I want to run the univariate Garch model as "arch X, arch(1/1) garch(1/1)", but can't get the estimation as per ID, in the below loop. X is the only variable that I am considering.
program define one_id
arch X, arch(1/1) garch(1/1)
foreach x in X {
gen coeff_`x' = _b[`x']
gen t_`x' = coeff_`x'/se_`x'
gen p_`x' = 2*t(e(df_r), -abs( t_`x'))
}
gen constant_term = _b[_cons]
predict V
predict resid, resid
exit
end
runby one_id,by(FI) status
arch X, arch(1/1) garch(1/1)
foreach x in X {
gen coeff_`x' = _b[`x']
gen t_`x' = coeff_`x'/se_`x'
gen p_`x' = 2*t(e(df_r), -abs( t_`x'))
}
gen constant_term = _b[_cons]
predict V
predict resid, resid
exit
end
runby one_id,by(FI) status
Comment