R的formula里用到的符号的含义,在做regression和anova的时候时常用到的,挺有用的,mark。
quote from: http://ww2.coastal.edu/kingw/statistics/R-tutorials/formulae.html
| symbol | example | meaning |
|---|---|---|
| + | + x | include this variable |
| – | – x | delete this variable |
| : | x : z | include the interaction between these variables |
| * | x * z | include these variables and the interactions between them |
| / | x / z | nesting: include z nested within x |
| | | x | z | conditioning: include x given z |
| ^ | (u + v + w)^3 | include these variables and all interactions up to three way |
| poly | poly(x,3) | polynomial regression: orthogonal polynomials |
| Error | Error(a/b) | specify the error term |
| I | I(x*z) | as is: include a new variable consisting of these variables multiplied |
| 1 | – 1 | intercept: delete the intercept (regress through the origin) |