R | R language expression commonly used symbols

 

symbol

use
~ Delimiter, response variable left, right for the explanatory variables, eg: through x, z and w are predicted y, code y ~ x + z + w
+ Separate predictors
: Indicates interaction term predictors eg: through interaction term prediction Y x, z and x and z, the code y ~ x + z + x: z
* Represents a simple embodiment all possible interactions items, the code y ~ x * z * w expands to y ~ x + z + w + x: z + x: w + z: w + x: z: w
^ Represents an interaction term to achieve frequency and the code y ~ (x + z + w) ^ 2 may be expanded as y ~ x + z + w + x: z + x: w + z: w
. Expressed by all the variables comprising external variable, eg in addition: If a data block contains variables x, y, z and w, the code may be expanded as y ~ y ~ x + z + w
- Minus, represents a variable is removed from the equation, eg: y ~ (x + z + w) ^ 2-x: w can be expanded as y ~ x + z + w + x: z + z: w
-1 Remove intercept, eg: y ~ x-1 represents a regression equation y in the x and force line passing through the origin
I() From the perspective of arithmetic elements to explain the brackets. Eg: y ~ x + (z + w) ^ 2 expands to y ~ x + z + w + z: w. Instead, the code y ~ x + I ((z + w) ^ 2) expands to y ~ x + h, h is created by a new variable and the square of z and w
function Mathematical function may be used in the expression, for example, log (y) ~ x + z + w represents a predicted log (y) by x, z, and w

Guess you like

Origin www.cnblogs.com/ykit/p/12501664.html