# Need help to estimate the Coef matrices in mAr

4 messages
Open this post in threaded view
|

## Need help to estimate the Coef matrices in mAr

 Dear R users, I am using mAr package to fit a Vector autoregressive model to my data. But here I want to put some predetermined values for some elements in coefficient matrix that mAr.est going to estimate. For example if p=3 then I want to put A3[1,3] = 0 and keep rest of the elements of coefficient matrices to be determined by mAr.est. Can anyone please tell me how can I do that? Sincerely yours, Arun         [[alternative HTML version deleted]] ______________________________________________ [hidden email] mailing list https://stat.ethz.ch/mailman/listinfo/r-helpPLEASE do read the posting guide http://www.R-project.org/posting-guide.htmland provide commented, minimal, self-contained, reproducible code.
Open this post in threaded view
|

## Re: Need help to estimate the Coef matrices in mAr

 Have you tried 'RSiteSearch("multivariate autoregression", "functions")'?  This produced 14 hits for me just now, the first of which mentions a package 'MSBVAR'.  Have you looked at that?       If that failed, I don't think it would be too hard to modify 'mAr.est' to do what you want.  If it were my problem, I might a local copy of the function, then add an argument accepting a 2 or 3-dimensional array with numbers for AR coefficients to be fixed and NAs for the coefficients.  Then I'd use 'debug' to walk through the function line by line until I figured out how to modify the function to do what I wanted.  I haven't checked all the details, so I don't know for sure if this would work, but the function contains a line 'R = qr.R(qr((rbind(K, diag(scale)))), complete = TRUE)' which I would start by decomposing, possibly starting as follows:       Z <-     rbind(K, diag(scale) I'd figure out how the different columns of Z relate to my problem, then modify it appropriately to get what I wanted.       Another alternative would be to program it from scratch using something like 'optim' to minimize the sum of squares of residuals over the free parameters in my AR matrices.   I'm confident I could make this work, even if the I somehow could not get it with either of the other two.       There may be something else  better, e.g., a Kalman filter representation, but I can't think how to do that off the top if my head.       Hope this helps.       Spencer Graves Arun Kumar Saha wrote: > Dear R users, > > I am using mAr package to fit a Vector autoregressive model to my data. But > here I want to put some predetermined values for some elements in > coefficient matrix that mAr.est going to estimate. For example if p=3 then I > want to put A3[1,3] = 0 and keep rest of the elements of coefficient > matrices to be determined by mAr.est. > > Can anyone please tell me how can I do that? > > Sincerely yours, > Arun > > [[alternative HTML version deleted]] > > ______________________________________________ > [hidden email] mailing list > https://stat.ethz.ch/mailman/listinfo/r-help> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html> and provide commented, minimal, self-contained, reproducible code. > ______________________________________________ [hidden email] mailing list https://stat.ethz.ch/mailman/listinfo/r-helpPLEASE do read the posting guide http://www.R-project.org/posting-guide.htmland provide commented, minimal, self-contained, reproducible code.