Skip to content
Back to formatted view

Raw Message

Message-ID: <e8dcd82ce7d84dad7405a1f4fc6627be@mail.gmail.com>
Date: 2020-01-29T20:17:21Z
From: Bill Denney
Subject: Error with nlme and varFixed

Hello,



When trying to fit an NLME model using a vector of varFixed, I get an error
that appears to be related to a multiplication issue at this line of code:

https://github.com/cran/nlme/blob/c006dfa23ad390948a74e67978a9828a6d60d89b/R/varFunc.R#L169



Is the below a bug or am I inaccurately applying varFixed (or something
else)?



Here is a reproducible example:



library(nlme)



d <-

  data.frame(

    obs=rnorm(n=97), # 97 chosen because it's prime and therefore can't be
the size of a rectangular matrix

    groups=rep(c("A", "B"), each=50)[1:97],

    wt=abs(rnorm(n=97))

  )



nlme(

  obs~b,

  fixed=b~1,

  random=b~1|groups,

  weights=varFixed(~wt),

 start=c(b=0),

  data=d

)



Which gets the error:



Error in recalc.varFunc(object[[i]], conLin) :

  dims [product 12] do not match the length of object [97]

In addition: Warning message:

In conLin$Xy * varWeights(object) :

  longer object length is not a multiple of shorter object length



Thanks,



Bill

	[[alternative HTML version deleted]]