-1

I would like to do a regression in R

The formula is y_t = alpha +beta* x_t-1 & x_t = theta + rho * x_t-1. Since I would like to estimate the covariance matrix of the error. I do not know how to run regression for both equation together. Thank you.

I tried

lm(c(y[2:756],x[2:756])~c(x[1:755],x[1:755]),data=data1)

756 is the length of vector, it does not work.

1
  • 1
    And what have you tried so far? One of the downvote reasons for this site is "This question does not show any research effort" - you are expected to make an attempt first. May 5, 2014 at 5:33

1 Answer 1

1

Your example looks like you are trying to fit an autoregressive model with lm. Try autoregressive models instead. For multivariate autoregressive models I suggest using the MTS package. Something like the following should work:

require("MTS")
VAR(data.frame(x=x, y=y))

For more detail, check out ?VAR. You may also want to have a look at the time series task view on CRAN.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.