how are the sum of squares computed for anova

5 views (last 30 days)
I've fit my multi-variable data to a linear model using the fitlm function from the Statistics and Machine Learning Toolbox. The output is a linear model which I then pass as an argument to the anova function. The output is a table listing a SumSq for each term in my model and the resulting F statistic and pValue.
>> anova(mdl_stp)
> In classreg.regr.CompactLinearModel>getTermSS1 (line 1336)
In classreg.regr.CompactLinearModel/componentanova (line 717)
In classreg.regr.CompactLinearModel/anova (line 311)
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND
= 3.145894e-21.
> In classreg.regr.CompactLinearModel>getTermSS1 (line 1336)
In classreg.regr.CompactLinearModel/componentanova (line 717)
In classreg.regr.CompactLinearModel/anova (line 311)
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND
= 1.500654e-17.
ans =
8×5 table
SumSq DF MeanSq F pValue
______ _____ _______ ______ __________
x 156.94 1 156.94 164.8 1.5552e-37
y 183.63 1 183.63 192.82 1.3846e-43
q 132.08 1 132.08 138.69 6.9855e-32
x:y 19.285 1 19.285 20.251 6.8386e-06
x^2 38.509 1 38.509 40.438 2.0849e-10
y^2 37.174 1 37.174 39.036 4.2667e-10
q^2 11.728 1 11.728 12.315 0.00045057
Error 15077 15832 0.95229
My question is how are the SumSq terms computed? I could not find any of the original data in the model, so I don't think additional fits with and without terms are performed. What then makes up the contributions of each term?

Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!