Martin Maechler
2022-Nov-17 08:16 UTC
[R] Rare behaviour for nlme::reStruct example and question about ?lmeObject
>>>>> Andrew Simmons >>>>> on Tue, 15 Nov 2022 18:01:55 -0500 writes:> This seems to be a bug. I tried creating this function in the global > environment: > str.pdMat <- function (object, ...) > { > if (nlme::isInitialized(object)) { > NextMethod() > } > else { > cat(" Uninitialized positive definite matrix structure of class ", > class(object)[1], ".\n", sep = "") > } > } Thank you, Iago, for the question and Andrew for your proposal. Yes, I agree that something like the above -- which is derived from the print.pdMat method -- should be added to nlme and will do this myself. > and the code you sent works: > > > library(nlme) > > rs1 <- reStruct(list(Dog = ~day, Side = ~1), data = Pixel) > > rs1 > Uninitialized random effects structure > > str(rs1) > List of 2 > $ Side: Uninitialized positive definite matrix structure of class pdLogChol. > $ Dog : Uninitialized positive definite matrix structure of class pdLogChol. > - attr(*, "settings")= int [1:5] 0 1 0 4 4 > - attr(*, "class")= chr "reStruct" In addition, Iago, asked > > > In addition to that I would like to ask if shouldn't be `terms` > > > documented in `?lmeObject`. I probably have misunderstood the question completely (?) I've now searched through ?lmeObject which was written under the assumption that the reader has already read (parts of) the ?lme help page. Now "terms" only appears in ?lmeObject in this paragraph fixDF: a list with components ?X? and ?terms? specifying the denominator degrees of freedom for, respectively, t-tests for the individual fixed effects and F-tests for the fixed-effects terms in the models. and I don't think that there needs to be more explanation. (??) Martin
Martin Maechler
2022-Nov-17 09:02 UTC
[R] Rare behaviour for nlme::reStruct example and question about ?lmeObject
>>>>> Martin Maechler >>>>> on Thu, 17 Nov 2022 09:16:04 +0100 writes:>>>>> Andrew Simmons >>>>> on Tue, 15 Nov 2022 18:01:55 -0500 writes:>> This seems to be a bug. I tried creating this function in the global >> environment: >> str.pdMat <- function (object, ...) >> { >> if (nlme::isInitialized(object)) { >> NextMethod() >> } >> else { >> cat(" Uninitialized positive definite matrix structure of class ", >> class(object)[1], ".\n", sep = "") >> } >> } > Thank you, Iago, for the question and Andrew for your proposal. > Yes, I agree that something like the above -- which is derived from the > print.pdMat method -- should be added to nlme and will do this > myself. My current working proposal gives this:> (rs <- reStruct(list(Dog = ~day, Side = ~1), data = Pixel))Uninitialized random effects structure> str(rs)List of 2 $ Side:Uninitialized 'pdLogChol', 'pdSymm', 'pdMat': ~1 $ Dog :Uninitialized 'pdLogChol', 'pdSymm', 'pdMat': ~day - attr(*, "settings")= int [1:5] 0 1 0 4 4 - attr(*, "class")= chr "reStruct">Martin
Iago
2022-Nov-17 10:53 UTC
[R] Rare behaviour for nlme::reStruct example and question about ?lmeObject
Thank you Martin, Regarding my question about `terms`, I meant the `terms` component of the `lme` output. For example, for fm1 <- lme(distance ~ age, data = Orthodont) I can see through str(fm1), the next: $ terms?????? :Classes 'terms', 'formula'? language distance ~ age ? .. ..- attr(*, "variables")= language list(distance, age) ? .. ..- attr(*, "factors")= int [1:2, 1] 0 1 ? .. .. ..- attr(*, "dimnames")=List of 2 ? .. .. .. ..$ : chr [1:2] "distance" "age" ? .. .. .. ..$ : chr "age" ? .. ..- attr(*, "term.labels")= chr "age" ? .. ..- attr(*, "order")= int 1 ? .. ..- attr(*, "intercept")= int 1 ? .. ..- attr(*, "response")= int 1 ? .. ..- attr(*, ".Environment")=<environment: R_GlobalEnv> ? .. ..- attr(*, "predvars")= language list(distance, age) ? .. ..- attr(*, "dataClasses")= Named chr [1:2] "numeric" "numeric" ? .. .. ..- attr(*, "names")= chr [1:2] "distance" "age" However, there is no paragraph for this component among those in ?lmeObject (in the Value section) as there is for fixDF, apVar, call, etc.. If not needed, I assume the explanation would be that `terms` does not need to be included in a legitimate ?"lme"? object'. Kind regards, Iago On 17/11/2022 09:16, Martin Maechler wrote:>>>>>> Andrew Simmons >>>>>> on Tue, 15 Nov 2022 18:01:55 -0500 writes: > > This seems to be a bug. I tried creating this function in the global > > environment: > > > str.pdMat <- function (object, ...) > > { > > if (nlme::isInitialized(object)) { > > NextMethod() > > } > > else { > > cat(" Uninitialized positive definite matrix structure of class ", > > class(object)[1], ".\n", sep = "") > > } > > } > > Thank you, Iago, for the question and Andrew for your proposal. > > Yes, I agree that something like the above -- which is derived from the > print.pdMat method -- should be added to nlme and will do this > myself. > > > and the code you sent works: > > > > > library(nlme) > > > rs1 <- reStruct(list(Dog = ~day, Side = ~1), data = Pixel) > > > rs1 > > Uninitialized random effects structure > > > str(rs1) > > List of 2 > > $ Side: Uninitialized positive definite matrix structure of class pdLogChol. > > $ Dog : Uninitialized positive definite matrix structure of class pdLogChol. > > - attr(*, "settings")= int [1:5] 0 1 0 4 4 > > - attr(*, "class")= chr "reStruct" > > In addition, Iago, asked > > > > > In addition to that I would like to ask if shouldn't be `terms` > > > > documented in `?lmeObject`. > > I probably have misunderstood the question completely (?) > > I've now searched through ?lmeObject > which was written under the assumption that the reader has > already read (parts of) the ?lme help page. > > Now "terms" only appears in ?lmeObject in this paragraph > > fixDF: a list with components ?X? and ?terms? specifying the > denominator degrees of freedom for, respectively, t-tests for > the individual fixed effects and F-tests for the > fixed-effects terms in the models. > > and I don't think that there needs to be more explanation. > > (??) > > Martin > >