% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/linear-algebra.R
\name{linear.algebra}
\alias{linear.algebra}
\alias{mat}
\alias{singvals}
\title{Functions for teaching linear algebra.}
\usage{
mat(formula, data = parent.frame(), A = formula)

singvals(formula, data = parent.frame(), A = formula)
}
\arguments{
\item{formula}{a formula.  In \code{mat} and \code{singvals},
only the right-hand side is used.}

\item{data}{a data frame from which to pull out numerical values
for the variables in the formula}

\item{A}{an alias for \code{formula} for backward compatibility.

\code{mat} returns a model matrix

To demonstrate singularity, use \code{singvals}.}
}
\value{
\code{mat} returns a matrix

\code{singvals} gives singular values for each column in the model matrix
}
\description{
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.
}
\examples{
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)
}
}
\seealso{
\code{\link[=project]{project()}}

\code{\link[=linearModel]{linearModel()}}, which returns a function.
}
