# stepwiseglm model seems to be missing parameters?

1 view (last 30 days)
Tomi Ylikorpi on 10 Mar 2022
Commented: Tomi Ylikorpi on 22 Mar 2022
In below, stepwiseglm produces a model without x1 and x2, but does not seem to be removing those during steps, and also gives estimates for their coefficients with proper pValue.
Is the model correct? If so, why are x1 and x2 not visible? In the same script, also two other models are produced, but they do include x1 and/or x2 in model, as appropriate.
g2 = stepwiseglm([Pplay,Lplay],(1/6)*DData(:,1),...
g2
1. Removing x1^5, Deviance = 0.26439, FStat = NaN, PValue = NaN
2. Removing (x1^4):x2, Deviance = 0.26439, FStat = NaN, PValue = NaN
3. Removing x1^4, Deviance = 0.26439, FStat = NaN, PValue = NaN
4. Removing (x1^3):(x2^2), Deviance = 0.26439, FStat = NaN, PValue = NaN
5. Removing (x1^3):x2, Deviance = 0.26439, FStat = NaN, PValue = NaN
6. Removing x1^3, Deviance = 0.26439, FStat = Inf, PValue = NaN
7. Removing (x1^2):(x2^3), Deviance = 0.26439, FStat = NaN, PValue = NaN
8. Removing (x1^2):(x2^2), Deviance = 0.26439, FStat = NaN, PValue = NaN
9. Removing (x1^2):x2, Deviance = 0.26439, FStat = NaN, PValue = NaN
10. Removing x1:(x2^4), Deviance = 0.26439, FStat = Inf, PValue = NaN
11. Removing x2^5, Deviance = 0.27142, FStat = 0.34533, PValue = 0.56684
12. Removing x1^2, Deviance = 0.30183, FStat = 1.5689, PValue = 0.23089
g2 =
Generalized linear regression model:
probit(y) ~ 1 + x1*x2 + x2^2 + x1:(x2^2) + x2^3 + x1:(x2^3) + x2^4
Distribution = Normal
Estimated Coefficients:
Estimate SE tStat pValue
___________ __________ _______ ________
(Intercept) -34.094 14.351 -2.3757 0.031276
x1 14692 5473.4 2.6842 0.016989
x2 -12245 5477.9 -2.2354 0.041019
x1:x2 -6.8006e+05 2.5664e+05 -2.6499 0.018196
x2^2 6.1705e+05 2.5588e+05 2.4115 0.029161
x1:x2^2 1.0401e+07 3.9814e+06 2.6124 0.019609
x2^3 -9.7049e+06 3.9728e+06 -2.4428 0.027425
x1:x2^3 -5.2558e+07 2.0434e+07 -2.5721 0.021248
x2^4 4.9767e+07 2.0411e+07 2.4382 0.027675
24 observations, 15 error degrees of freedom
Estimated Dispersion: 0.0201
F-statistic vs. constant model: 2.89, p-value = 0.0364

Ive J on 19 Mar 2022
It does include both. You should mind the model formula in MATLAB (AKA Wilkinson Notation): x1*x2 is x1 + x2 + x1:x2.
mathworks.com/help/releases/R2021b/stats/wilkinson-notation.html
Tomi Ylikorpi on 22 Mar 2022
Ah, thanks a lot! Absolutely explains the issue. :)

### Categories

Find more on Statistics and Machine Learning Toolbox in Help Center and File Exchange

R2021a

### Community Treasure Hunt

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

Start Hunting!