when i have first order autocorrelation in simple linear regression (y=a+b*x) i can transforme the variables by this way, or appending the term ar(1).
Code: Select all
e=c(1)*e(-1)
scalar p=c(1)
smpl 1 1
series yy=((1-p)^0.5)*y
series xx=((1-p)^0.5)*x
series const=((1-p)^0.5)
smpl 2 @last
series yy=y-p*y(-1)
series xx=x-p*x(-1)
series cont=1-p
smpl @all
yy const xxCode: Select all
e=c(1)*e(-1)+c(2)*e(-2)
scalar p1=c(1)
scalar p2=c(2)
smpl 1 1
series yy={(1+p2)*[(1-p2)^2-p1^2]/(1-p2)}^0.5*y
series xx={(1+p2)*[(1-p2)^2-p1^2]/(1-p2)}^0.5*x
series const={(1+p2)*[(1-p2)^2-p1^2]/(1-p2)}^0.5
smpl 2 2
series yy=(1-p2^2)^0.5*y2-[p1*(1-p1^2)^0.5/(1-p1)]*y1
series xx=(1-p2^2)^0.5*x2-[p1*(1-p1^2)^0.5/(1-p1)]*x1
series const=(1-p2^2)^0.5-[p1*(1-p1^2)^0.5/(1-p1)]
smpl 3 @last
series yy=y-p1*y(-1)+p2*y(-2)
series xx=x-p1*x(-1)+p2*x(-2)
series const=1-p1-p2
smpl @all
yy const xx(*) when i use smpl 2 2 i can not multiply y1 x1 (first obs of variable y and x), how can do this?
(**) when i appending ar(1) ar(2) whith CLS method i lose 2 obs, but i can use GLS method to keep the 2 obs, is this the Prais-Winsten procedure in EViews to transforme directly the two first obs?
Best Regards CHERIF.
