Andrew Simmons
2022-Nov-15 23:01 UTC
[R] Rare behaviour for nlme::reStruct example and question about ?lmeObject
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 = "") } } and the code you sent works:> library(nlme) > rs1 <- reStruct(list(Dog = ~day, Side = ~1), data = Pixel) > rs1Uninitialized 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">I'll suggest adding it, hopefully it will appear in the next update. In the meantime, you could add the function to your Rprofile, something like: con <- file("~/.Rprofile", "a") writeLines(r"(str.pdMat <- function (object, ...) { if (nlme::isInitialized(object)) { NextMethod() } else { cat(" Uninitialized positive definite matrix structure of class ", class(object)[1], ".\n", sep = "") } })", con) close(con) so that every time you start a new R session, this function is added to your global environment. On Tue, Nov 15, 2022 at 5:20 PM Iago <iago.gine at sjd.es> wrote:> > Dear Bert and all other "helpers", > > > I agree that not all of you are developers. If I look at the DESCRIPTION > of the nlme package I can see the next: > > Contact: see 'MailingList' > > BugReports: https://bugs.r-project.org > MailingList: R-help at r-project.org > > Maintainer: R Core Team <R-core at R-project.org> > > As I do not have bugs.r-project account, first I emailed to > R-core at R-project.org, from where I got the next answer > > "Non-members are typically*NOT* allowed to post messages to this > private developers' list. Please use an appropriate mailing list (from > http://www.r-project.org/mail.html). For R packages, use > maintainer("<pkg>") in R (and if that is R-core at .., use the R-help > address). > > --> i.e. for nlme use R-help > > by Martin Maechler. Therefore, I used R-help. > > Best, > > Iago > > > On 15/11/2022 16:20, Bert Gunter wrote: > > 1. Not developers, helpers (though there may be some developers among > > us, too). Ergo, we don't make changes to code or man pages either. > > > > 2. If no satisfactory reply here, R-Sig-mixed-models is where you > > should post. And post there first for mixed models questions in future. > > > > Cheers, > > Bert > > > > > > On Mon, Nov 14, 2022 at 11:24 PM IAGO GIN? V?ZQUEZ <iago.gine at sjd.es> > > wrote: > > > > Dear developers, > > > > When I run the example code in the help of reStruct, I get > > > > > > > library(nlme) > > > rs1 <- reStruct(list(Dog = ~day, Side = ~1), data = Pixel) > > > rs1 > > Uninitialized random effects structure > > > str(rs1) > > List of 2 > > $ Side:Error in pdMatrix.pdSymm(x) : > > cannot extract matrix from an uninitialized object > > > > > > Is it expected? > > > > In addition to that I would like to ask if shouldn't be `terms` > > documented in `?lmeObject`. > > > > > > Kind regards, > > > > Iago > > > > > > > > > > [[alternative HTML version deleted]] > > > > ______________________________________________ > > R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see > > https://stat.ethz.ch/mailman/listinfo/r-help > > PLEASE do read the posting guide > > http://www.R-project.org/posting-guide.html > > <http://www.R-project.org/posting-guide.html> > > and provide commented, minimal, self-contained, reproducible code. > > > > [[alternative HTML version deleted]] > > ______________________________________________ > R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see > 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.
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