2
$\begingroup$

Using python package statsmodel and the code in this link:

If a linear mixed model has a random variable with x groups. then why when one would run this code:

data = sm.datasets.get_rdataset('dietox', 'geepack').data
md = smf.mixedlm("Weight ~ Time", data, groups=data["Pig"])
mdf = md.fit()
print(mdf.summary())

Does it only produce one value for the intercept parameter?

     Mixed Linear Model Regression Results
========================================================
Model:            MixedLM Dependent Variable: Weight
No. Observations: 861     Method:             REML
No. Groups:       72      Scale:              11.3669
Min. group size:  11      Log-Likelihood:     -2404.7753
Max. group size:  12      Converged:          Yes
Mean group size:  12.0
--------------------------------------------------------
             Coef.  Std.Err.    z    P>|z| [0.025 0.975]
--------------------------------------------------------
Intercept    15.724    0.788  19.952 0.000 14.179 17.268
Time          6.943    0.033 207.939 0.000  6.877  7.008
Group Var    40.394    2.149
========================================================

The table says that there are 72 different groups (in this case pigs). Yet the table only shows one intercept value, i.e.: 15.724

How do I interpret the table in relationship to what is happening "under the hood"? or in other words: How does that one value relate to the other 72 intercepts?

$\endgroup$
2
$\begingroup$

The intercept estimate of 15.724 is the global intercept, around which the (72) random intercepts vary. The random intercepts are estimated as samples from a normal distribution with a variance of 40.384 and mean of zero - hence the need for a global (fixed) intercept.

| cite | improve this answer | |
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.