Class: GeneralizedLinearModel
Remove terms from generalized linear model
mdl1 = removeTerms(mdl,terms)
returns
a linear model the same as mdl1
= removeTerms(mdl
,terms
)mdl
but with fewer terms.
|
Generalized linear model, as constructed by |
|
Terms to remove from the regression model
|
|
Generalized linear model, the same as |
removeTerms
treats a categorical predictor as follows:
A model with a categorical predictor that has L levels
(categories) includes L – 1 indicator variables. The model uses the first category as a
reference level, so it does not include the indicator variable for the reference
level. If the data type of the categorical predictor is
categorical
, then you can check the order of categories
by using categories
and reorder the
categories by using reordercats
to customize the
reference level.
removeTerms
treats the group of L – 1 indicator variables as a single variable. If you want to treat
the indicator variables as distinct predictor variables, create indicator
variables manually by using dummyvar
. Then use the
indicator variables, except the one corresponding to the reference level of the
categorical variable, when you fit a model. For the categorical predictor
X
, if you specify all columns of
dummyvar(X)
and an intercept term as predictors, then the
design matrix becomes rank deficient.
Interaction terms between a continuous predictor and a categorical predictor with L levels consist of the element-wise product of the L – 1 indicator variables with the continuous predictor.
Interaction terms between two categorical predictors with L and M levels consist of the (L – 1)*(M – 1) indicator variables to include all possible combinations of the two categorical predictor levels.
You cannot specify higher-order terms for a categorical predictor because the square of an indicator is equal to itself.
step
adds or removes terms from a model using
a greedy one-step algorithm.
[1] Wilkinson, G. N., and C. E. Rogers. Symbolic description of factorial models for analysis of variance. J. Royal Statistics Society 22, pp. 392–399, 1973.