[R] Need help to estimate the Coef matrices in mAr
Spencer Graves
spencer.graves at pdf.com
Sat Sep 30 19:03:19 CEST 2006
I'm sorry, but I can't follow what you are asking. If you'd like
more help, please provide commented, minimal, self-contained,
reproducible code, as suggested in the posting guide
"www.R-project.org/posting-guide.html".
<http://www.R-project.org/posting-guide.html> Please include a minimal
data set, e.g., 10 simulated observations on 2 variables, with comments
describing what you tried and what you don't understand about it.
Hope this helps.
Spencer Graves
Arun Kumar Saha wrote:
>
> Dear Spencer,
>
>
>
> Thank you very much for your attention on my problem. According to
> your advice I did some home work on this problem, but unfortunately I
> could not solve my problem.
>
>
>
>
>
> Suppose I have a dataset of length 300 with 2 variables. And I want to
> fit a VAR model on this of order 2.
>
>
>
> I went through the function mAr.est and got understand that, here 'K'
> is a matrix with (300-2) rows and 7 columns. the first col. consists
> only 1, next two columns consist of lagged values of two variables
> with lag-length 2, next two col. consist of lagged value with lag
> length-1, and next two cols are for lag-length-0.
>
>
>
> Next, they add additional a 7-7 matrix to K. For this matrix diagonal
> elements are the square root of sum of square of elements of K (col.
> wise) and rest of the elements are 0.
>
>
>
> I feel that this matrix, that is added to K, is the key matrix for any
> type of modification that you prescribed. Therefore for experimental
> purpose I put NA against one of its off-diagonal elements. But I got
> error.
>
>
>
> However I cannot understand why they put such figures for diagonal and
> off-diagonal elements of that matrix.
>
>
>
> Can you suggest me any solution more specifically?
>
>
>
>
>
> Thanks and regards,
>
> Arun
>
>
>
> On 9/4/06, *Spencer Graves* <spencer.graves at pdf.com
> <mailto:spencer.graves at pdf.com>> wrote:
>
> 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]]
> >
> > ______________________________________________
> > R-help at stat.math.ethz.ch <mailto:R-help at stat.math.ethz.ch>
> mailing list
> > https://stat.ethz.ch/mailman/listinfo/r-help
> <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.
> >
>
>
>
>
> --
> Arun Kumar Saha, M.Sc.[C.U.]
> S T A T I S T I C I A N [Analyst]
> RISK MANAGEMENT DIVISION
> Transgraph Consulting [ www.transgraph.com <http://www.transgraph.com>]
> Hyderabad, INDIA
> Contact # Home: (91-033) 25558038
> Office: (91-040) 30685012 Ext. 17
> FAX: (91-040) 55755003
> Mobile: 919989122010
> E-Mail: arun.riskanalyst at transgraph.com
> <mailto:arun.riskanalyst at transgraph.com>
> arun.kumar.saha at gmail.com <mailto:arun.kumar.saha at gmail.com>
More information about the R-help
mailing list