File: solveCrossprod.Rd

package info (click to toggle)
strucchange 1.5-1-2
  • links: PTS
  • area: main
  • in suites: stretch
  • size: 1,164 kB
  • sloc: makefile: 1
file content (24 lines) | stat: -rw-r--r-- 790 bytes parent folder | download | duplicates (9)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
\name{solveCrossprod}
\alias{solveCrossprod}
\title{Inversion of X'X}
\description{Computes the inverse of the cross-product of a matrix X.}
\usage{
solveCrossprod(X, method = c("qr", "chol", "solve"))
}
\arguments{
  \item{X}{a matrix, typically a regressor matrix.}
  \item{method}{a string indicating whether the QR decomposition,
    the Cholesky decomposition or \code{solve} should be used.}
}
\details{Using the Cholesky decomposition of X'X (as computed by \code{crossprod(X)})
is computationally faster and preferred to \code{solve(crossprod(X))}. Using the
QR decomposition of X is slower but should be more accurate.}

\value{a matrix containing the inverse of \code{crossprod(X)}.}

\examples{
X <- cbind(1, rnorm(100))
solveCrossprod(X)
solve(crossprod(X))
}
\keyword{algebra}