2

Some weeks ago, I posted a poorly thought-out question plagued with vague information. This is my attempt to correct the original question and get better answers.

The main problem is: I cannot obtain similar parameter estimates with EViews and R.

For reasons I do not know myself, I need to estimate parameters for certain data using EViews. This is done by picking the NLS (nonlinear least squares) option and using the following formula: indep_var c dep_var ar(1)

EViews claims that they estimate linear AR(1) processes such as:

Yt = a + B * Xt + ut

where ut errors are defined as

ut = p * ut-1 + e

by using an equivalent equation (with some algebraic substitutions):

Yt = (1 - p) * a + p * Yt - 1 + B * Xt - p * B * Xt - 1 + et

Furthermore, this thread over at the EViews forums suggests that their NLS estimations are generated by the Marquardt algorithm.

Now, the go-to R function to estimate AR(1) processes is arima. However, there are two problems: 1) the estimates are maximum likelihood estimates; 2) the intercept estimate is not actually the intercept estimate.

Therefore, I turned to the nlsLM function from the minpack.lm package. This function uses the Marquardt algorithm to achieve nonlinear least squares estimates, which should yield the same results as the EViews implementation (or very similar ones, at least).

Now the code. I have a data frame (data) with an independent variable and a dependent variable such as the one generated by the following code:

data <- data.frame(independent = abs(rnorm(48)), dependent = abs(rnorm(48)))

To estimate parameters in the equation EViews claims to estimate (3rd one on this post), I use the following commands:

library(minpack.lm)
result <-
nlsLM(dependentB ~ ((1 - theta1) * theta2) + (theta1 * dependentA) +
                    (theta3 * independentB) - (theta1 * theta3 * independentA),
data = list(dependentB = data$dependent[2:48], dependentA = data$dependent[1:47],
   independentB = data$independent[2:48], independentA = data$independent[1:47]),
start = list(theta1 = -10, theta2 = -10, theta3 = -10)
)

Unfortunately, the estimates output by nlsLM are not close to the ones output by EViews. Do you have any idea of what might be causing this? Or maybe my code is wrong?

Finally, I would like to say that I personally am an R user - that is exactly why I'm trying to do this in R instead of EViews. I would also love to provide you the data I'm working with but it's impossible since it's confidential data.

Community
  • 1
  • 1
Fael
  • 183
  • 2
  • 10

1 Answers1

0

It seems that the Eviews specification should be:

dep_var  c indep_var ar(1)
Robert
  • 5,038
  • 1
  • 25
  • 43