Michael
2006-May-17 04:55 UTC
[R] what does it mean when "lm.gls" says that the weight matrix has wrong dimension?
If first fit my data column V1 to column V2 using normal "lm" fitting, call it "fit1", then I used "acf(fit1$residuals, type='cov', 40) " function to obtain the autocovariance of the residuals, and then constructed a autocovariance matrix, I chose it to be 40x40. Call this autocovariance matrix B, I then use the following "lm.gls" function to fit using the above weight matrix: But what's wrong with my weight matrix?> fit8=lm.gls(V1~V2, data=data1, W=B, inverse=TRUE);Error in lm.gls(V1 ~ V2, data = data1, W = B, inverse = TRUE) : dim(W) is not correct [[alternative HTML version deleted]]
Peter Dalgaard
2006-May-17 06:15 UTC
[R] what does it mean when "lm.gls" says that the weight matrix has wrong dimension?
Michael <comtech.usa at gmail.com> writes:> If first fit my data column V1 to column V2 using normal "lm" fitting, > > call it "fit1", > > then I used "acf(fit1$residuals, type='cov', 40) " function to obtain the > autocovariance of the residuals, > > and then constructed a autocovariance matrix, I chose it to be 40x40. > > Call this autocovariance matrix B, > > I then use the following "lm.gls" function to fit using the above weight > matrix: > > But what's wrong with my weight matrix? > > > fit8=lm.gls(V1~V2, data=data1, W=B, inverse=TRUE); > Error in lm.gls(V1 ~ V2, data = data1, W = B, inverse = TRUE) : > dim(W) is not correct(That's in the MASS package, and the authors of the book it supports like you to say so. The rest of us would like to be spared the help.search step...) I would guess that either V1 does not have length 40 or dim(B) isn't 40x40 even though you intended it to be. -- O__ ---- Peter Dalgaard ?ster Farimagsgade 5, Entr.B c/ /'_ --- Dept. of Biostatistics PO Box 2099, 1014 Cph. K (*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918 ~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk) FAX: (+45) 35327907