1

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.

Fael
  • 183
  • 2
  • 10
  • Fael: Your lm() formula looks very wrong. You seem to be saying: dep[i] ~ indep[i+1] + dep[i]. That is circular since dep[today] depends upon dep[today]. It might be backwards, too, if "i" means today and "i+1" means tomorrow. A usual model would be: dep[i+1] ~ indep[i] + dep[i]. Could you either correct or clarify your question? – pteetor Oct 11 '12 at 00:26
  • Yes, you are absolutely correct. The model is exactly as you describe. Yet, I cannot seem to get results that closely resemble those obtained in Eviews. – Fael Oct 11 '12 at 14:33
  • perhaps you are looking for something like `library(nlme); gls(dependent~independent, correlation=corAR1(), data=df)` ? It seems like we may need more detail/reproducibility before we can answer ... http://tinyurl.com/reproducible-000 – Ben Bolker Oct 11 '12 at 15:06
  • On my comment on @Jilber 's answer, I explained I had already tried using the gls function to no avail. Furthermore, gls uses ML instead of OLS (as the arima function does, too). I am truly sorry but I cannot post any code to reproduce because the original series are confidential data. I am just trying to match the results in Eviews to the results in R. Thanks for your suggestion! – Fael Oct 11 '12 at 15:42
  • 2
    Can you simulate a small data set in R, fit it in Eviews and R, and let us see the data and the results? – Ben Bolker Oct 11 '12 at 17:01

1 Answers1

3

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.

Jilber Urbina
  • 58,147
  • 10
  • 114
  • 138
  • I did try the arima function, as well as the gls function (nlme package). Both output similar results. However, [this](http://www.stat.pitt.edu/stoffer/tsa3/Rissues.htm) website says that the estimation of the arima function is NOT on the intercept but on the mean. Moreover, arima uses ML instead of OLS. I did read the arima help page and I do think that R.H. Shumway & D.S. Stoffer are correct in their criticism. Is my lm approach completely and fundamentally wrong? – Fael Oct 09 '12 at 19:58