R - Formula ( ~ tilde)

Card Puncher Data Processing


A formula in S is indicated by the ~ character.


Design Matrix

A formula is commonly used to generate design matrices for modeling function (e.g. lm).

mod1 <- lm(Sepal.Width ~ Petal.Width + log(Petal.Length) + Species, 
           data = iris, subset = Sepal.Length > 4.6)

Documentation / Reference

Discover More
Rplotting Character
R - Plot (Graphic System)

The general form of a formula specifying a plot is where: y is the coordinate on the vertical axis, x is the coordinate on the horizontal axis, and g is a grouping factor or expression. For...
Lasso Cv Plot
R - Shrinkage Method (Ridge Regression and Lasso)

Unlike subset and forward stepwise regression, which controls the complexity of a model by restricting the number of variables, ridge regression keeps all the variables in and shrinks the coefficients...
Card Puncher Data Processing
R - Tilde Operator

A formula in S is indicated by the tilde character. The Tilde operator separate the left- and right-hand sides in a model formula. where: The left hand is a dependent variable) The right hand is...
Thomas Bayes
Statistics - Design Matrix (X)

The design matrix is a representation of the explanatory variables (a.k.a. the X matrix) where: instances of data are in rows and variable attributes are in columns . In R: model.matrix...

Share this page:
Follow us:
Task Runner