Re: [R] Rare behaviour for nlme::reStruct example and question about ?lmeObject

2022-11-18 Thread Martin Maechler
> Iago  
> on Thu, 17 Nov 2022 11:53:31 +0100 writes:

> 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")=
>   .. ..- 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

I see; now I understand what you meant. I've taken time to check and
found that the 'terms' part *is* needed, even though not for the
simplest methods such as summary(), residuals(), ..  and so have
added it to the  ?lmeObject  help page for the next version of
nlme.

Thank you, Iago!

Best,
Martin

__
R-help@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.


Re: [R] Rare behaviour for nlme::reStruct example and question about ?lmeObject

2022-11-17 Thread Iago

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")=
  .. ..- 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




__
R-help@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.


Re: [R] Rare behaviour for nlme::reStruct example and question about ?lmeObject

2022-11-17 Thread Martin Maechler
> 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

__
R-help@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.


Re: [R] Rare behaviour for nlme::reStruct example and question about ?lmeObject

2022-11-17 Thread Martin Maechler
> 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

__
R-help@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.


Re: [R] Rare behaviour for nlme::reStruct example and question about ?lmeObject

2022-11-15 Thread Andrew Simmons
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)
> 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"
>

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  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@r-project.org
>
> Maintainer: R Core Team 
>
> As I do not have bugs.r-project account, first I emailed to
> r-c...@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("") in R (and if that is R-core@.., 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 
> > 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@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.
> >
>
> [[alternative HTML version deleted]]
>
> __
> R-help@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.

__
R-help@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.


Re: [R] Rare behaviour for nlme::reStruct example and question about ?lmeObject

2022-11-15 Thread Iago
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@r-project.org

Maintainer: R Core Team 

As I do not have bugs.r-project account, first I emailed to 
r-c...@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("") in R (and if that is R-core@.., 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  
> 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@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.
>

[[alternative HTML version deleted]]

__
R-help@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.


Re: [R] Rare behaviour for nlme::reStruct example and question about ?lmeObject

2022-11-15 Thread Bert Gunter
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  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@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.
>

[[alternative HTML version deleted]]

__
R-help@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.


[R] Rare behaviour for nlme::reStruct example and question about ?lmeObject

2022-11-14 Thread IAGO GINÉ VÁZQUEZ
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@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.