Linear mixed models not working
1 view (last 30 days)
Show older comments
Hello, I am interested in fitting a random intercept linear mixed model to my data. My response variable is Spike_prob, my predictor is gen and grouping variable is animal. Here is the formula I use:
lme = fitlme(data,'Spike_prob~1+gen+(1|animal)')
Linear mixed-effects model fit by ML
Model information:
Number of observations 209
Fixed effects coefficients 2
Random effects coefficients 13
Covariance parameters 2
Formula:
Spike_prob ~ 1 + gen + (1 | animal)
Model fit statistics:
AIC BIC LogLikelihood Deviance
-225.27 -211.91 116.64 -233.27
Fixed effects coefficients (95% CIs):
Name Estimate SE tStat DF
'(Intercept)' 0.22942 0.014438 15.89 207
'gen' -0.061785 0.019297 -3.2019 207
pValue Lower Upper
1.0669e-37 0.20096 0.25788
0.0015807 -0.099828 -0.023742
Random effects covariance parameters (95% CIs):
Group: animal (13 Levels)
Name1 Name2 Type Estimate Lower
'(Intercept)' '(Intercept)' 'std' 0 NaN
Upper
NaN
Group: Error
Name Estimate Lower Upper
'Res Std' 0.13848 0.12582 0.15242
Why do I get the exact same p and DF values when I do not include the random intercept term?
lme = fitlme(data,'Spike_prob~1+gen')
lme =
Linear mixed-effects model fit by ML
Model information:
Number of observations 209
Fixed effects coefficients 2
Random effects coefficients 0
Covariance parameters 1
Formula:
Spike_prob ~ 1 + gen
Model fit statistics:
AIC BIC LogLikelihood Deviance
-227.27 -217.25 116.64 -233.27
Fixed effects coefficients (95% CIs):
Name Estimate SE tStat DF
'(Intercept)' 0.22942 0.014438 15.89 207
'gen' -0.061785 0.019297 -3.2019 207
pValue Lower Upper
1.0669e-37 0.20096 0.25788
0.0015807 -0.099828 -0.023742
Random effects covariance parameters (95% CIs):
Group: Error
Name Estimate Lower Upper
'Res Std' 0.13848 0.12582 0.15242
0 Comments
Answers (1)
Peng Li
on 1 Sep 2020
In your first equation with random effect, you see that the random effect estimate is 0. If you check your data, you will find out that your variable gen is always the same in a given animal. They are sort of duplicating each other.
0 Comments
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!