[R-sig-ME] lme: count the number extra parameters estimated for variance or covariances

Viechtbauer, Wolfgang (SP) wo||g@ng@v|echtb@uer @end|ng |rom m@@@tr|chtun|ver@|ty@n|
Sun Nov 1 16:44:40 CET 2020


Dear Simon,

For variance structures, you can use:

coef(fit$modelStruct$varStruct)

That will give you the parameter estimates involved in the variance structure (in their constrained form as used during the optimization). With:

coef(fit$modelStruct$varStruct, unconstrained=FALSE)

you can get the unconstrained estimates. Only coefficients that are actually estimated are returned by default. With:

coef(fit$modelStruct$varStruct, unconstrained=FALSE, allCoef=TRUE)

you will also get the coefficient (= 1) for the males. But that is not actually an estimated parameter. For more details, see:

help(coef.varFunc)

And these *are* parameters (besides the fixed effects and the vars/covs of the random effects).

Best,
Wolfgang

>-----Original Message-----
>From: R-sig-mixed-models [mailto:r-sig-mixed-models-bounces using r-project.org]
>On Behalf Of Harold Doran
>Sent: Sunday, 01 November, 2020 16:26
>To: Simon Harmel
>Cc: r-sig-mixed-models
>Subject: Re: [R-sig-ME] lme: count the number extra parameters estimated for
>variance or covariances
>
>I think you need to understand what a reproducible example is intended to
>do. Your data estimates a model and yields a fiitted model object. What
>parameter from that object using an extractor are you intending to find?
>
>For example, a well posed question would be something like. I want to
>extract the fixed effects from a fitted model object. How do I get them?
>
>To say I want the “parameters estimated for modeling residual variances” etc
>makes no sense. The parameters of a mixed model are the fixed effects and
>the marginal variances (and covariances) of the random effects.
>
>So, specifically what parameters do you think exist in a model that you
>want?
>
>From: Simon Harmel <sim.harmel using gmail.com>
>Sent: Sunday, November 1, 2020 9:58 AM
>To: Harold Doran <harold.doran using cambiumassessment.com>
>Cc: r-sig-mixed-models <r-sig-mixed-models using r-project.org>
>Subject: Re: [R-sig-ME] lme: count the number extra parameters estimated for
>variance or covariances
>
>Dear Harold,
>
>My question "specifically" is:  is there a way (e.g., via an extractor
>function) to obtain parameters estimated for modeling residual variances or
>covariances from an "lme" model?
>
>For concreteness, please consider the reproducible model I provided in my
>original post in which a variance function has been used.
>
>Thanks,
>
>On Sun, Nov 1, 2020, 4:43 AM Harold Doran
><harold.doran using cambiumassessment.com<mailto:harold.doran using cambiumassessment.co
>m>> wrote:
>In order to answer that you need to specify what "thing" you want. The
>object itself has many things and there are extractor functions to grab many
>of them. I say "thing" because the *parameters* of a mixed model are the
>fixed effects and the variance components. Random effects etc are not
>parameters of a mixed model.
>
>You can always look at the structure of a fitted model object in R to see
>what things are generally in it.
>
>-----Original Message-----
>From: R-sig-mixed-models <r-sig-mixed-models-bounces using r-project.org<mailto:r-
>sig-mixed-models-bounces using r-project.org>> On Behalf Of Simon Harmel
>Sent: Sunday, November 1, 2020 4:02 AM
>To: r-sig-mixed-models <r-sig-mixed-models using r-project.org<mailto:r-sig-mixed-
>models using r-project.org>>
>Subject: [R-sig-ME] lme: count the number extra parameters estimated for
>variance or covariances
>
>External email alert: Be wary of links & attachments.
>
>Hello All,
>
>In addition to fixed and random effects, is there a way to extract how many
>other parameters (for modeling residual variances or covariances) an "lme()"
>object has estimated?
>
>Here is a reproducible example:
>
>library(nlme)
>
>hsb <- read.csv('
>https://raw.githubusercontent.com/rnorouzian/e/master/hsb.csv')
>hsb$female <- as.factor(hsb$female)
>
>fit <- lme(math ~ female, random = ~ 1|sch.id<http://sch.id>, data = hsb,
>weights = varIdent(form = ~1 |female))


More information about the R-sig-mixed-models mailing list