[R] R vs EViews - serial correlation

Remigijus Lapinskas remigijus.lapinskas at mif.vu.lt
Thu Sep 23 16:29:24 CEST 2004


Dear all,

I met with some problems when dealing with a time series with serial correlation.

FIRST, I generate a series with correlated errors

set.seed(1)
x=1:50
y=x+arima.sim(n = 50, list(ar = c(0.47)))

SECOND, I estimate three constants (a, b and rho) in the model Y=a+b*X+u, where u=rho*u(-1)+eps
 
library(nlme)
gls(y~x,correlation = corAR1(0.5))     # Is it the right procedure?

Coefficients:
(Intercept)           x 
  0.1410465   1.0023341 

Correlation Structure: AR(1)
 Formula: ~1 
 Parameter estimate(s):
     Phi 
0.440594 
Degrees of freedom: 50 total; 48 residual
Residual standard error: 0.9835158

THIRD, I do the same procedure with EViews as LS Y C X AR(1) and get
Y = 0.1375 + 1.0024*X + [AR(1)=0.3915]

My problem is actually connected with the fitting procedure. As far as I understand 

gls(y~x,correlation = corAR1(0.5))$fit

is obtained through the linear equation 0.1410+1.0023*X while in EViews through the nonlinear equation 

Y=rho*Y(-1) + (1-rho)*a+(X-rho*X(-1))*b

where either dynamic or static fitting procedures are applied. 

    X       Y    YF_D    YF_S gls.fit
1   1  1.1592      NA      NA  1.1434
2   2  3.5866  2.1499  2.1499  2.1457
3   3  4.1355  3.1478  3.7103  3.1480
4   4  3.9125  4.1484  4.5352  4.1504
5   5  2.7442  5.1502  5.0578  5.1527
6   6  6.0647  6.1523  5.2103  6.1551
7   7  6.9855  7.1547  7.1203  7.1574
.....................................
47 47 49.4299 47.2521 47.5288 47.2507
48 48 48.7748 48.2545 49.1072 48.2531
49 49 48.3200 49.2570 49.4607 49.2554
50 50 50.2501 50.2594 49.8926 50.2578

All gls.fit values are on a line, YF_D (D for dynamic) soon begin
to follow a line and YF_S (S for static) try to mimic Y.

My question is: do R and EViews estimate the same model? If yes, why
the estimates are different and which of the two (three?) procedures
is "correct"?

Thanking you in advance,
Rem




More information about the R-help mailing list