Replies: 2 comments 2 replies
-
I have committed a julia> using DataFrames, MixedModels, MixedModelsMakie
[ Info: Precompiling MixedModelsMakie [b12ae82c-6730-437f-aff9-d2c38332a376]
julia> m = fit(MixedModel, @formula(reaction ~ 1+days+(1+days|subj)), MixedModels.dataset(:sleepstudy))
Linear mixed model fit by maximum likelihood
reaction ~ 1 + days + (1 + days | subj)
logLik -2 logLik AIC AICc BIC
-875.9697 1751.9393 1763.9393 1764.4249 1783.0971
Variance components:
Column Variance Std.Dev. Corr.
subj (Intercept) 565.51068 23.78047
days 32.68212 5.71683 +0.08
Residual 654.94145 25.59182
Number of obs: 180; levels of grouping factors: 18
Fixed-effects parameters:
──────────────────────────────────────────────────
Coef. Std. Error z Pr(>|z|)
──────────────────────────────────────────────────
(Intercept) 251.405 6.63226 37.91 <1e-99
days 10.4673 1.50224 6.97 <1e-11
──────────────────────────────────────────────────
julia> DataFrame(shrinkage(m))
18×3 DataFrame
Row │ levels within mixed
│ String NamedTup… NamedTup…
─────┼──────────────────────────────────────────────────────────────────────────────
1 │ S308 ((Intercept) = 244.193, days = 2… ((Intercept) = 254.221, days = 1…
2 │ S309 ((Intercept) = 205.055, days = 2… ((Intercept) = 211.357, days = 1…
3 │ S310 ((Intercept) = 203.484, days = 6… ((Intercept) = 212.972, days = 4…
4 │ S330 ((Intercept) = 289.685, days = 3… ((Intercept) = 274.237, days = 5…
5 │ S331 ((Intercept) = 285.739, days = 5… ((Intercept) = 272.955, days = 7…
6 │ S332 ((Intercept) = 264.252, days = 9… ((Intercept) = 260.221, days = 1…
7 │ S333 ((Intercept) = 275.019, days = 9… ((Intercept) = 267.847, days = 1…
8 │ S334 ((Intercept) = 240.163, days = 1… ((Intercept) = 244.408, days = 1…
9 │ S335 ((Intercept) = 263.035, days = -… ((Intercept) = 250.368, days = -…
10 │ S337 ((Intercept) = 290.104, days = 1… ((Intercept) = 286.071, days = 1…
11 │ S349 ((Intercept) = 215.112, days = 1… ((Intercept) = 226.847, days = 1…
12 │ S350 ((Intercept) = 225.835, days = 1… ((Intercept) = 239.071, days = 1…
13 │ S351 ((Intercept) = 261.147, days = 6… ((Intercept) = 255.679, days = 7…
14 │ S352 ((Intercept) = 276.372, days = 1… ((Intercept) = 272.027, days = 1…
15 │ S369 ((Intercept) = 254.968, days = 1… ((Intercept) = 254.664, days = 1…
16 │ S370 ((Intercept) = 210.449, days = 1… ((Intercept) = 226.695, days = 1…
17 │ S371 ((Intercept) = 253.636, days = 9… ((Intercept) = 252.128, days = 9…
18 │ S372 ((Intercept) = 267.045, days = 1… ((Intercept) = 263.524, days = 1… I would appreciate if @jkrumbiegel and others could advise me on code style with regard to the plotting. Instead of producing a column table (in the sense of the If there were more than two coefficients for each level then I think the plot should have multiple Axis regions in a scatterplot matrix arrangement (possibly just one triangle of the matrix). I am trying to decide if I should write a recipe for Is the "create a Type and a recipe for said Type" route the general approach to extending |
Beta Was this translation helpful? Give feedback.
-
Just to close this out, #21 provides a shrinkage plot that avoids going through fitting fixed-effects models to each subgroup of observations. When you get into complicated designs with crossed grouping factors it is not easy to decide what should be compared. Instead we use the existing LinearMixedModel struct and insert a very large value of the parameter vector, corresponding to a covariance factor, Λ, that is a large multiple of the identity. This has the effect of removing the shrinkage on the values of b while still allowing them to be evaluated. (If you remove the shrinkage entirely then |
Beta Was this translation helpful? Give feedback.
-
only(m.reterms)
) contains:refs
vector to determine the groupslevels
field to create the labelscnames
field to determine which coefficients are to be shownXymat
field will be split according torefs
for fitting the within-group models.cnames
(names come fromm.feterm
)ranef()
returns the conditional modes as a NamedTuple of matrices (levels are columns, for easier display)ranef()
matrixBeta Was this translation helpful? Give feedback.
All reactions