1
$\begingroup$

I've fitted an LMER-model in Statsmodels, and I'd like to illustrate my results with a plot. My data consists of 14 groups, measured once daily during a timeperiod of 15 days (there are a few deviations which I drop from the model). My DV is Volume, and I have one IV in form of a compound score (ranging from -1 to 1).

My model was not significant, but I'd still like to present it in a way that I can discuss my results, and why it may have turned out the way it did.

The output of my model:

                       Mixed Linear Model Regression Results
===================================================================================
Model:                   MixedLM      Dependent Variable:      Volume              
No. Observations:        192          Method:                  REML                
No. Groups:              14           Scale:                   584821472433971.7500
Min. group size:         8            Log-Likelihood:          -3524.7301          
Max. group size:         15           Converged:               Yes                 
Mean group size:         13.7                                                      
-----------------------------------------------------------------------------------
                 Coef.           Std.Err.     z    P>|z|     [0.025       0.975]   
-----------------------------------------------------------------------------------
Intercept         42431069.111  9074786.978  4.676 0.000  24644813.466 60217324.756
Score            -13627881.121  8478309.044 -1.607 0.108 -30245061.498  2989299.256
Group Var 1086895076253949.250 19188470.954                                        
===================================================================================

I have two questions:

How do you interpret the Group Var Coefficient?

What type of plot would be a suitable approach to illustrate my results?

$\endgroup$

1 Answer 1

0
$\begingroup$

Can you scale your data to different units, say multiply Score by 10^6 and divide Volume by 10^6? Doing this would make the results easier to work with, you might even be loosing precision with the huge values that you are getting.

The ICC (intraclass correlation coefficient) is Group_var / (Group_var + scale), both values are in the output above. The ICC tells you how strongly the residual variation is clustered by group.

For plotting, you could plot y against x (as noted the slope is not significantly different from zero). You could also plot y against x for each group, using the BLUP of the intercept and the common slope. You can get the BLUPs with the "random_effects" method.

$\endgroup$
6
  • $\begingroup$ How do you plot y against x for each group if you have random intercept and slope? $\endgroup$
    – OLGJ
    May 21, 2021 at 15:20
  • $\begingroup$ You could plot one line for each group (not the actual data points since the plot would be too busy). The intercepts and slopes of these lines would be the BLUPs obtained from the random_effects method. If you have up to maybe 50 groups this gives a good visual impression of the heterogeneity captured by the random effects. $\endgroup$ May 22, 2021 at 22:53
  • $\begingroup$ So if I use the random_effects method, my data is an output in the form of 'AAPL': Group 551.911565 Score 16.597515 dtype: float64, .... and so on for each group. Do I understand you correctly that Group 551.911565 represents the intercept, and Score 16.597515 represents the slope? I've been having a hard time understand what these actually represents. But am I correct when I assume then that the datapoint corresponding to e.g measurement i=4, j=AAPL, is equal to: Y(ij) = 551.911565 + 16.597515i ? $\endgroup$
    – OLGJ
    May 23, 2021 at 10:30
  • $\begingroup$ Or do I take the estimated intercept of the model (330 in my case) and add the group intercept? So for i = 4, j = AAPL; Y(4, AAPL) = 330+ 551.911565 + 16.587515*4? $\endgroup$
    – OLGJ
    May 23, 2021 at 11:07
  • $\begingroup$ You are correct, to make this plot, for each group you add the fixed interecept to the BLUP of the subject random intercept, and add the fixed slope to the BLUP of the subject random slope. The fixed effects are in 'params', and the BLUPs for each group are in 'random_effects'. Then you plot a line for each group with the given intercept and slope. You probably want to use some transparancy (alpha) to reduce the overplotting. $\endgroup$ May 24, 2021 at 15:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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