简体   繁体   中英

OLS estimation with AR(1) term

For reasons that I cannot explain (because I can't, not because I don't want to), a process used at my office requires running some regressions on Eviews.

The equation specification used on Eviews is:

dependent_variable c independent_variable ar(1)

Furthermore, the process used is "NLS and ARMA."

I don't use Eviews but, as I understand it, that equation means an OLS regression with a constant, one independent variable and an AR(1) term. I tried running this in R:

result <- lm(df$dependent[2:48] ~ df$independent[1:47] + df$dependent[1:47])

Where df is a data.frame containing the dependent and independent variables (both spanning 48 observations).

Am I doing it right? Because the parameter estimations, while similar, are different in Eviews. Different enough that I cannot use them.

I've thoroughly searched the internet for what this means. I've read up on ARIMA and ARMAX models but I don't think that this is it. I'm sorry but I'm not that knowledgeable on statistics. By the way, estimating ARMAX models seems very complicated and is done by ML, not LS, so I'm really hoping that's not it.

EDIT: I had to edit the model indexes again because I messed them up, again .

You need arima function, see ?arima

Example with some data

y <- lh  # lh is Luteinizing Hormone in Blood Samples in datasets package (Base)
set.seed(001)
x <- rnorm(length(y), 100, 10)
arima(y, order = c(1,0,0), xreg=x)

Call:
arima(x = y, order = c(1, 0, 0), xreg = x)

Coefficients:
         ar1  intercept       x
      0.5810     1.8821  0.0053
s.e.  0.1153     0.6991  0.0068

sigma^2 estimated as 0.195:  log likelihood = -29.08,  aic = 66.16

See ?arima to find help about its arguments.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM