Learn R Programming

spaMM (version 1.1)

designL.from.Corr: Computation of square root of correlation matrix

Description

For given correlation matrix C, this computes a design matrix L such that C = L * t(L). This function is normally not directly called by users, but they may need to pass options through higher-level functions (see Examples). chol (Cholesky factorization) is a fast method for this computation, but it is not robust numerically and may even return an error, in which cases other methods (eigen or svd) are used. Note that these methods differ by much more than simply numerical accuracy, and in particular that this will affect the simulation of samples for the parametric bootstrap implemented in fixedLRT.

Usage

designL.from.Corr(m,try.chol=TRUE,try.eigen=FALSE,threshold=1e-06,debug=FALSE)

Arguments

m
The matrix which 'root' is to be computed.
try.chol
If try.chol=TRUE, the Cholesky factorization will be tried.
try.eigen
The default behavior is to try chol, and use svd if chol fails. If try.eigen=TRUE, the eigen factori
threshold
A correction threshold for low eigenvalues is the case and eigensystem or singular-value decomposition are used.
debug
Not documented, only for development purposes.

Value

  • The square root of the input matrix. Its rows andcolumns are labelled according to the columns of the original matrix.

Examples

Run this code
## try.chol argument passed to designL.from.Corr 
## through the '...' argument of higher-level functions
## such as HLCor, corrHLfit, fixedLRT:

#### using HLCor
data(scotlip)
HLCor(cases~I(prop.ag/10) +adjacency(1|gridcode)+offset(log(scotlip$expec)),
      ranPars=list(rho=0.174),adjMatrix=Nmatrix,family=poisson(),
      data=scotlip,try.chol=FALSE)

Run the code above in your browser using DataLab