Learn R Programming

VCA (version 1.3.1)

Solve: Solve System of Linear Equations using Inverse of Cholesky-Root.

Description

This function is intended to reduce the computational time in function solveMME which computes the inverse of the square variance- covariance Matrix of observations. It is considerably faster than function solve (see example). Whenever an error occurs, which is the case for non positive definite matrices 'X', function MPinv is called automatically yielding a generalized inverse (Moore-Penrose inverse) of 'X'.

Usage

Solve(X, quiet = FALSE)

Arguments

X
(matrix, Matrix) object to be inverted
quiet
(logical) TRUE = will suppress any warning, which will be issued otherwise

Value

(matrix, Matrix) corresponding to the inverse of X

Examples

Run this code
## Not run: 
# # following complex (nonsense) model takes pretty long to fit
# system.time(res.sw <- anovaVCA(y~(sample+lot+device)/day/run, VCAdata1))
# # solve mixed model equations (not automatically done to be more efficient)
# system.time(res.sw <- solveMME(res.sw))
# # extract covariance matrix of observations V
# V1 <- getMat(res.sw, "V")
# V2 <- as.matrix(V1)
# system.time(V2i <- solve(V2))
# system.time(V1i <- VCA:::Solve(V1))
# V1i <- as.matrix(V1i)
# dimnames(V1i) <- NULL
# dimnames(V2i) <- NULL
# all.equal(V1i, V2i)
# ## End(Not run)

Run the code above in your browser using DataLab