How to run anova after fitlmematrix to obtain the F statistics
I am following the example of fitlmematrix under longitudinal data with a covariate at: https://www.mathworks.com/help/stats/fitlmematrix.html;
Breifly I build design matrix of the fixed and random effect for the model
y ~ Intercept + InitWeight + PrgB + PrgC + PrgD + Week + Week_PrgB + Week_PrgC + Week_PrgD + (Intercept + Week | Subject)
And then run the code:
lme = fitlmematrix(X,y,Z,G,’FixedEffectPredictors’,{‘Intercept’,’InitWeight’,’PrgB’,’PrgC’,’PrgD’,’Week’,’Week_PrgB’,’Week_PrgC’,’Week_PrgD’},’RandomEffectPredictors’,{{‘Intercept’,’Week’}},’RandomEffectGroups’,{‘Subject’})
I obtain the t-stats for each term:
Fixed effects coefficients (95% CIs):
Name Estimate SE tStat DF pValue Lower Upper
{‘Intercept’ } 0.66105 0.25892 2.5531 111 0.012034 0.14798 1.1741
{‘InitWeight’} 0.0031879 0.0013814 2.3078 111 0.022863 0.00045067 0.0059252
{‘PrgB’ } 0.36079 0.13139 2.746 111 0.0070394 0.10044 0.62113
{‘PrgC’ } -0.033263 0.13117 -0.25358 111 0.80029 -0.29319 0.22666
{‘PrgD’ } 0.11317 0.13132 0.86175 111 0.39068 -0.14706 0.3734
{‘Week’ } 0.1732 0.067454 2.5677 111 0.011567 0.039536 0.30686
{‘Week_PrgB’ } 0.038771 0.095394 0.40644 111 0.68521 -0.15026 0.2278
{‘Week_PrgC’ } 0.030543 0.095394 0.32018 111 0.74944 -0.15849 0.21957
{‘Week_PrgD’ } 0.033114 0.095394 0.34713 111 0.72915 -0.15592 0.22214
I am wondering, if it is possible to obtain a F-stats for all Programs (Prg). Anova(lme) in this case will give F-stats for individual terms instead of grouping them together.
Term FStat DF1 DF2 pValue
{‘Intercept’ } 6.5184 1 111 0.012034
{‘InitWeight’} 5.326 1 111 0.022863
{‘PrgB’ } 7.5406 1 111 0.0070394
{‘PrgC’ } 0.064305 1 111 0.80029
{‘PrgD’ } 0.74261 1 111 0.39068
{‘Week’ } 6.593 1 111 0.011567
{‘Week_PrgB’ } 0.16519 1 111 0.68521
{‘Week_PrgC’ } 0.10251 1 111 0.74944
{‘Week_PrgD’ } 0.1205 1 111 0.72915I am following the example of fitlmematrix under longitudinal data with a covariate at: https://www.mathworks.com/help/stats/fitlmematrix.html;
Breifly I build design matrix of the fixed and random effect for the model
y ~ Intercept + InitWeight + PrgB + PrgC + PrgD + Week + Week_PrgB + Week_PrgC + Week_PrgD + (Intercept + Week | Subject)
And then run the code:
lme = fitlmematrix(X,y,Z,G,’FixedEffectPredictors’,{‘Intercept’,’InitWeight’,’PrgB’,’PrgC’,’PrgD’,’Week’,’Week_PrgB’,’Week_PrgC’,’Week_PrgD’},’RandomEffectPredictors’,{{‘Intercept’,’Week’}},’RandomEffectGroups’,{‘Subject’})
I obtain the t-stats for each term:
Fixed effects coefficients (95% CIs):
Name Estimate SE tStat DF pValue Lower Upper
{‘Intercept’ } 0.66105 0.25892 2.5531 111 0.012034 0.14798 1.1741
{‘InitWeight’} 0.0031879 0.0013814 2.3078 111 0.022863 0.00045067 0.0059252
{‘PrgB’ } 0.36079 0.13139 2.746 111 0.0070394 0.10044 0.62113
{‘PrgC’ } -0.033263 0.13117 -0.25358 111 0.80029 -0.29319 0.22666
{‘PrgD’ } 0.11317 0.13132 0.86175 111 0.39068 -0.14706 0.3734
{‘Week’ } 0.1732 0.067454 2.5677 111 0.011567 0.039536 0.30686
{‘Week_PrgB’ } 0.038771 0.095394 0.40644 111 0.68521 -0.15026 0.2278
{‘Week_PrgC’ } 0.030543 0.095394 0.32018 111 0.74944 -0.15849 0.21957
{‘Week_PrgD’ } 0.033114 0.095394 0.34713 111 0.72915 -0.15592 0.22214
I am wondering, if it is possible to obtain a F-stats for all Programs (Prg). Anova(lme) in this case will give F-stats for individual terms instead of grouping them together.
Term FStat DF1 DF2 pValue
{‘Intercept’ } 6.5184 1 111 0.012034
{‘InitWeight’} 5.326 1 111 0.022863
{‘PrgB’ } 7.5406 1 111 0.0070394
{‘PrgC’ } 0.064305 1 111 0.80029
{‘PrgD’ } 0.74261 1 111 0.39068
{‘Week’ } 6.593 1 111 0.011567
{‘Week_PrgB’ } 0.16519 1 111 0.68521
{‘Week_PrgC’ } 0.10251 1 111 0.74944
{‘Week_PrgD’ } 0.1205 1 111 0.72915 I am following the example of fitlmematrix under longitudinal data with a covariate at: https://www.mathworks.com/help/stats/fitlmematrix.html;
Breifly I build design matrix of the fixed and random effect for the model
y ~ Intercept + InitWeight + PrgB + PrgC + PrgD + Week + Week_PrgB + Week_PrgC + Week_PrgD + (Intercept + Week | Subject)
And then run the code:
lme = fitlmematrix(X,y,Z,G,’FixedEffectPredictors’,{‘Intercept’,’InitWeight’,’PrgB’,’PrgC’,’PrgD’,’Week’,’Week_PrgB’,’Week_PrgC’,’Week_PrgD’},’RandomEffectPredictors’,{{‘Intercept’,’Week’}},’RandomEffectGroups’,{‘Subject’})
I obtain the t-stats for each term:
Fixed effects coefficients (95% CIs):
Name Estimate SE tStat DF pValue Lower Upper
{‘Intercept’ } 0.66105 0.25892 2.5531 111 0.012034 0.14798 1.1741
{‘InitWeight’} 0.0031879 0.0013814 2.3078 111 0.022863 0.00045067 0.0059252
{‘PrgB’ } 0.36079 0.13139 2.746 111 0.0070394 0.10044 0.62113
{‘PrgC’ } -0.033263 0.13117 -0.25358 111 0.80029 -0.29319 0.22666
{‘PrgD’ } 0.11317 0.13132 0.86175 111 0.39068 -0.14706 0.3734
{‘Week’ } 0.1732 0.067454 2.5677 111 0.011567 0.039536 0.30686
{‘Week_PrgB’ } 0.038771 0.095394 0.40644 111 0.68521 -0.15026 0.2278
{‘Week_PrgC’ } 0.030543 0.095394 0.32018 111 0.74944 -0.15849 0.21957
{‘Week_PrgD’ } 0.033114 0.095394 0.34713 111 0.72915 -0.15592 0.22214
I am wondering, if it is possible to obtain a F-stats for all Programs (Prg). Anova(lme) in this case will give F-stats for individual terms instead of grouping them together.
Term FStat DF1 DF2 pValue
{‘Intercept’ } 6.5184 1 111 0.012034
{‘InitWeight’} 5.326 1 111 0.022863
{‘PrgB’ } 7.5406 1 111 0.0070394
{‘PrgC’ } 0.064305 1 111 0.80029
{‘PrgD’ } 0.74261 1 111 0.39068
{‘Week’ } 6.593 1 111 0.011567
{‘Week_PrgB’ } 0.16519 1 111 0.68521
{‘Week_PrgC’ } 0.10251 1 111 0.74944
{‘Week_PrgD’ } 0.1205 1 111 0.72915 fitlmematrix MATLAB Answers — New Questions