Function solves a system of linear equations, respectively, inverts a matrix by means of the inverse Cholesky-root.
(matrix, Matrix) object to be inverted
(logical) TRUE = will suppress any warning, which will be issued otherwise
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
MPinv is called automatically yielding a generalized
inverse (Moore-Penrose inverse) of 'X'.
(matrix, Matrix) corresponding to the inverse of X
Andre Schuetzenmeister [email protected]
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
## 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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.