How to run a time series model on panel data?

For questions regarding programming in the EViews programming language.

Moderators: EViews Gareth, EViews Jason, EViews Moderator, EViews Matt

Mihailo Savic
Posts: 12
Joined: Mon Jan 29, 2018 9:57 am

Re: How to run a time series model on panel data?

Postby Mihailo Savic » Thu Feb 01, 2018 10:06 am


Everything works perfectly! Thank you so much! This is the final product:

Code: Select all

matrix ((@rows(gvkey))/38,7) eq1_m
matrix ((@rows(gvkey))/38,9) eq2_m
matrix ((@rows(gvkey))/38,11) eq3_m
matrix ((@rows(gvkey))/38,9) eq4_m
matrix ((@rows(gvkey))/38,2) ys_adf
scalar rows=@rows(gvkey)
scalar i=1
scalar j=1
while i<rows
   smpl if gvkey=!gvk
   series y{!gvk}=log(adjusted_oibdp)
   series x{!gvk}=log(capital_expenditures)
   series s{!gvk}=sale
   series u{!gvk}=cur
   equation eq{!gvk}.ls y{!gvk} c y{!gvk}(-1)
   eq1_m(j,1) = !gvk
   eq1_m(j,2) = eq{!gvk}.@rbar2
   eq1_m(j,3) = eq{!gvk}.@se
   eq1_m(j,4) = eq{!gvk}.@coefs(1)
   eq1_m(j,5) = eq{!gvk}.@tstats(1)
   eq1_m(j,6) = eq{!gvk}.@coefs(2)
   eq1_m(j,7) = eq{!gvk}.@tstats(2)
   equation eq{!gvk} y{!gvk} c y{!gvk}(-1) x{!gvk}
   eq2_m(j,1) = !gvk
   eq2_m(j,2) = eq{!gvk}x.@rbar2
   eq2_m(j,3) = eq{!gvk}x.@se
   eq2_m(j,4) = eq{!gvk}x.@coefs(1)
   eq2_m(j,5) = eq{!gvk}x.@tstats(1)
   eq2_m(j,6) = eq{!gvk}x.@coefs(2)
   eq2_m(j,7) = eq{!gvk}x.@tstats(2)
   eq2_m(j,8) = eq{!gvk}x.@coefs(3)
   eq2_m(j,9) = eq{!gvk}x.@tstats(3)
   equation eq{!gvk} y{!gvk} c y{!gvk}(-1) x{!gvk} @trend
   eq3_m(j,1) = !gvk
   eq3_m(j,2) = eq{!gvk}tr.@rbar2
   eq3_m(j,3) = eq{!gvk}tr.@se
   eq3_m(j,4) = eq{!gvk}tr.@coefs(1)
   eq3_m(j,5) = eq{!gvk}tr.@tstats(1)
   eq3_m(j,6) = eq{!gvk}tr.@coefs(2)
   eq3_m(j,7) = eq{!gvk}tr.@tstats(2)
   eq3_m(j,8) = eq{!gvk}tr.@coefs(3)
   eq3_m(j,9) = eq{!gvk}tr.@tstats(3)
   eq3_m(j,10) = eq{!gvk}tr.@coefs(4)
   eq3_m(j,11) = eq{!gvk}tr.@tstats(4)
   equation eq{!gvk} y{!gvk} c s{!gvk} u{!gvk}
   eq4_m(j,1) = !gvk
   eq4_m(j,2) = eq{!gvk}cur.@rbar2
   eq4_m(j,3) = eq{!gvk}cur.@se
   eq4_m(j,4) = eq{!gvk}cur.@coefs(1)
   eq4_m(j,5) = eq{!gvk}cur.@tstats(1)
   eq4_m(j,6) = eq{!gvk}cur.@coefs(2)
   eq4_m(j,7) = eq{!gvk}cur.@tstats(2)
   eq4_m(j,8) = eq{!gvk}cur.@coefs(3)
   eq4_m(j,9) = eq{!gvk}cur.@tstats(3)
   eq{!gvk}cur.makeresid rescur
   freeze(adftable) y{!gvk}.uroot(adf)
   ys_adf(j,1)= !gvk
   ys_adf(j,2)= @val(adftable(7,4))
   d adftable
   while i<rows and !gvk=gvkey(i)

Apart from that I still need to manually save the data into excel from the 5 matrixes and I still need to look at an individual eq to view the residuals (that were fixed by changing "scalar gvk" to "!gvk").

Thank you again. I hope I wont need further help. (But I probably will.)


Return to “Programming”

Who is online

Users browsing this forum: miorinnovo and 6 guests