linear.algebra | R Documentation |
These functions provide a formula based interface to the construction of matrices from data and for fitting. You can use them both for numerical vectors and for functions of variables in data frames. These functions are intended to support teaching basic linear algebra with a particular connection to statistics.
mat(formula, data = parent.frame(), A = formula)
singvals(formula, data = parent.frame(), A = formula)
formula |
a formula. In |
data |
a data frame from which to pull out numerical values for the variables in the formula |
A |
an alias for
To demonstrate singularity, use |
mat
returns a matrix
singvals
gives singular values for each column in the model matrix
project()
linearModel()
, which returns a function.
a <- c(1,0,0); b <- c(1,2,3); c <- c(4,5,6); x <- rnorm(3)
# Formula interface
mat(~a+b)
mat(~a+b+1)
if (require(mosaicData)) {
mat(~length+sex, data=KidsFeet)
singvals(~length*sex*width, data=KidsFeet)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.