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:

$$

Y_t = alpha + beta X_t + u_t

$$

where $u_t$ errors are defined as:

$$

u_t = rho cdot u_{t-1} + varepsilon

$$

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

$$

Y_t = (1 – rho) alpha + rho Y_{t – 1} + beta X_t – rho beta X_{t – 1} + varepsilon_t

$$

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:

- the estimates are maximum likelihood estimates;
- the intercept estimate is not actually the intercept estimate (according to R.H. Shumway & D.S. Stoffer).

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 (3^{rd} 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.

**Contents**hide

#### Best Answer

Your NLLS has four ortoghonality conditions, one per variable plus the constant (analogue to normal equations in standard OLS) to solve for three parameters ($rho, beta, alpha$ ). The Non-linear algorithms often have heterogenous configurations for tolerance parameters across softwares. MAy I suggest you drop $X_{t-1}$ from your equation in order to get exactly identified system and then test Eviews against R ? if both agree, it probably means one of them has troubles with the overidentification.

### Similar Posts:

- Solved – GARCH estimates differ in rugarch (R) vs. EViews
- Solved – How to calculate the PDF of the ‘difference’ between two Beta distributions
- Solved – Controlling for variables in pooled OLS estimation in EViews
- Solved – How to estimate a nonlinear equation system in R
- Solved – Bayes factor for selecting between two beta-distributions