| covFun {gremlin} | R Documentation |
(Co)variance parameter transformations.
Description
Converts lists of (co)variance parameters either between list and
vector format or between the theta and nu scales.
Usage
stTrans(x)
conTrans(Gcon, Rcon)
start2theta(Gstart, Rstart, name = NULL)
matlist2vech(theta)
vech2matlist(vech, skeleton)
theta2nu_trans(theta)
nu2theta_trans(nu)
theta2nu_lambda(theta, thetaG, thetaR)
nu2theta_lambda(nu, sigma2e, thetaG, thetaR)
nuVar2thetaVar_lambda(object)
nuAI2thetaAIinv_lambda(object)
nu2theta_noTrans(nu, thetaG, thetaR)
Arguments
x, theta, nu |
A |
Gcon, Rcon |
A |
Gstart, Rstart |
A |
name |
An (optional) character |
vech |
A |
skeleton |
An example structure to map |
thetaG, thetaR |
A |
sigma2e |
A |
object |
An object of |
Details
stTransTransform start parameters into lower triangle matrices of classdsCMatrix.conTransTransformation of starting constraints to correct format.start2thetaConverts lists of starting values for (co)variance parameters to a theta object used to structure the (co)variance components within gremlin.matlist2vechConverts alistof (co)variance parameter matrices to a vector with a “skel” attribute.vech2matlistConverts a vector of (co)variance parameters to a list of covariance matrices.theta2nu_transTransforms theta to nu scale by taking the Cholesky factor of each covariance matrix and then replacing the diagonals with their (natural) logarithms. Done to ensure matrices are positive definite.nu2theta_transBack transformation fromtheta2nu_trans: exponentiates the diagonal elements of each matrix then calculates the cross-product.theta2nu_lambdaTransformation that factors out a residual variance so thatnucontains the ‘lambda’ parameterization: ratios of variance parameters with the residual variance.nu2theta_lambdaBack transformation fromtheta2nu_lambda.nuVar2thetaVar_lambdaTransformation of Sampling Variances fromlambdaScale fortheta.nuAI2thetaAIinv_lambdaTransform AI matrix fromlambdaScale to AI-inverse oftheta.nu2theta_noTransStructuresthetawhen not transformed.
Value
Functions are specified to mostly return either a list of
matrices (structure as defined by the “skel” attribute or in
the skeleton object) or a vector containing the (co)variance
parameters of the model. Additional list elements returned can be:
- thetaG
A
vectorindexing the G-structure components.- thetaR
A
vectorindexing the R-structure components.
Alternatively, nuVar2thetaVar_lambda and nuAI2thetaAIinv_lambda
return a vector and matrix, respectively, holding the sampling
(co)variances of the model (co)variance parameters both on the theta
scale. These are elements of the inverse Average Information matrix.
Author(s)
Examples
# User-specified starting parameters
thetaOut <- start2theta(Gstart = list(matrix(1), matrix(2)),
Rstart = matrix(3))
## convert to a vector and then back into a matrix list
thetav <- matlist2vech(thetaOut$theta)
theta <- vech2matlist(thetav, attr(thetav, "skel"))
identical(thetaOut$theta, theta) #<-- should be TRUE
# lambda parameterization transformation
nu <- theta2nu_lambda(theta, thetaOut$thetaG, thetaOut$thetaR)
# back-transform from (lambda scale) nu to theta
## For example, when the sigma2e estimate=0.5
theta2 <- nu2theta_lambda(nu, sigma2e = 0.5, thetaOut$thetaG, thetaOut$thetaR)