`mdl1 = addTerms(mdl,terms)`

returns
a linear model `mdl1`

= addTerms(`mdl`

,`terms`

)`mdl1`

that is the same as the input
model `mdl`

, but with additional terms as specified
by `terms`

.

Wilkinson notation describes the factors present in models. The notation relates to factors present in models, not to the multipliers (coefficients) of those factors.

Wilkinson Notation | Factors in Standard Notation |
---|---|

`1` | Constant (intercept) term |

`A^k` , where `k` is a positive
integer | `A` , `A` ,
..., `A` |

`A + B` | `A` , `B` |

`A*B` | `A` , `B` , `A*B` |

`A:B` | `A*B` only |

`-B` | Do not include `B` |

`A*B + C` | `A` , `B` , `C` , `A*B` |

`A + B + C + A:B` | `A` , `B` , `C` , `A*B` |

`A*B*C - A:B:C` | `A` , `B` , `C` , `A*B` , `A*C` , `B*C` |

`A*(B + C)` | `A` , `B` , `C` , `A*B` , `A*C` |

Statistics and Machine Learning Toolbox™ notation always includes a constant term
unless you explicitly remove the term using `-1`

.

For details, see Wilkinson and Rogers [1].

[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.

Use `stepwiselm`

to select
a model from a starting model, continuing until no single step is
beneficial.

Use `removeTerms`

to remove particular terms.

Use `step`

to
optimally improve the model by adding or removing terms.

Was this topic helpful?