This repository has been archived by the owner on Nov 19, 2022. It is now read-only.
Fetch tidy names in grouped mixed-model #25
Comments
Better to use set.seed(123)
library(lme4)
library(dplyr)
options(tibble.width = Inf)
iris %>%
group_by(Species) %>%
group_modify(., ~ broomExtra::easystats_to_tidy_names(as.data.frame(parameters::model_parameters(
lme4::lmer(Sepal.Length ~ Petal.Length + Petal.Width + Petal.Length * Petal.Width + (1 | Sepal.Width),
data = .x,
control = lme4::lmerControl(optimizer = "bobyqa")
)
))))
#> Registered S3 method overwritten by 'broom.mixed':
#> method from
#> tidy.gamlss broom
#> # A tibble: 12 x 9
#> # Groups: Species [3]
#> Species term estimate std.error conf.low conf.high
#> <fct> <chr> <dbl> <dbl> <dbl> <dbl>
#> 1 setosa (Intercept) 3.73 0.961 1.85 5.62
#> 2 setosa Petal.Length 0.900 0.635 -0.344 2.14
#> 3 setosa Petal.Width 3.56 3.67 -3.64 10.8
#> 4 setosa Petal.Length:Petal.Width -2.34 2.35 -6.94 2.27
#> 5 versicolor (Intercept) 1.08 2.89 -4.58 6.74
#> 6 versicolor Petal.Length 1.23 0.677 -0.0930 2.56
#> 7 versicolor Petal.Width 0.814 2.39 -3.87 5.50
#> 8 versicolor Petal.Length:Petal.Width -0.259 0.537 -1.31 0.793
#> 9 virginica (Intercept) -4.04 4.16 -12.2 4.11
#> 10 virginica Petal.Length 1.92 0.753 0.444 3.40
#> 11 virginica Petal.Width 2.53 2.07 -1.52 6.58
#> 12 virginica Petal.Length:Petal.Width -0.459 0.371 -1.19 0.269
#> statistic df.error p.value
#> <dbl> <int> <dbl>
#> 1 3.88 44 0.000104
#> 2 1.42 44 0.156
#> 3 0.969 44 0.332
#> 4 -0.994 44 0.320
#> 5 0.374 44 0.708
#> 6 1.82 44 0.0684
#> 7 0.340 44 0.734
#> 8 -0.482 44 0.630
#> 9 -0.972 44 0.331
#> 10 2.55 44 0.0108
#> 11 1.22 44 0.221
#> 12 -1.23 44 0.217 Created on 2020-10-21 by the reprex package (v0.3.0) |
Such a boss! Thanks for the support. |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
This issue is related to Issue 21.
In the example below I want to loop through
Species
which I can do usinggrouped_tidy
orgrouped_glance
My goal is to obtain the p-values that I can obtain using
parameters::model_parameters()
I tried using the code supplied on the GitHubIO but was unable to fetch p-values. I tried 2 versions of
tidy.args
P.S: Was going to post on GitHub but there are not any
broomExtra
tags permitted at the moment so it seemed best to post here to get a response. Apologies if this is a mundane questionThe text was updated successfully, but these errors were encountered: