Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Specifying random effects in nlme::lme #965

Open
simonbmk opened this issue Nov 8, 2024 · 1 comment
Open

Specifying random effects in nlme::lme #965

simonbmk opened this issue Nov 8, 2024 · 1 comment
Labels
3 investigators ❔❓ Need to look further into this issue Bug 🐛 Something isn't working

Comments

@simonbmk
Copy link

simonbmk commented Nov 8, 2024

I am having trouble understanding the behaviour of parameters() on lme objects under different specifications of the random effects (corresponding to method (i) and (iv) in the lme documentation of the random = argument).

When the random effect is specified using formula with pipe for grouping, parameters behaves as expected,

library("nlme")
library("parameters")

lme(weight ~ Treatment,
             random = ~ 1 | Litter,
             data = RatPupWeight) |>
    parameters()

However, parameters fail on the same model specified with a list (the names indicating the grouping),

lme(weight ~ Treatment,
             random = list(Litter = ~ 1),
             data = RatPupWeight) |>
    parameters()
@strengejacke strengejacke transferred this issue from easystats/parameters Nov 8, 2024
@strengejacke
Copy link
Member

I think it's an issue in insight::find_formula(), thus I transferred this issue.

library("nlme")
m <- lme(weight ~ Treatment, random = ~ 1 | Litter, data = RatPupWeight) 
insight::find_formula(m)
#> $conditional
#> weight ~ Treatment
#> 
#> $random
#> ~1 | Litter
#> <environment: 0x0000022e632548f8>
#> 
#> attr(,"class")
#> [1] "insight_formula" "list"

m <- lme(weight ~ Treatment, random = list(Litter = ~ 1), data = RatPupWeight)
insight::find_formula(m)
#> $conditional
#> weight ~ Treatment
#> 
#> $random
#> $random$Litter
#> ~1
#> <environment: 0x0000022e63748508>
#> 
#> 
#> attr(,"class")
#> [1] "insight_formula" "list"

Created on 2024-11-08 with reprex v2.1.1

@strengejacke strengejacke added Bug 🐛 Something isn't working 3 investigators ❔❓ Need to look further into this issue labels Nov 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3 investigators ❔❓ Need to look further into this issue Bug 🐛 Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants