x, theta, nu: A list of matrices containing the (co)variance parameters of the model.
Gcon, Rcon: A list of starting (co)variance constraints for the G-structure (random effects terms) or R-structure (residual).
Gstart, Rstart: A list of starting (co)variance values for the G-structure (random effects terms) or R-structure (residual).
name: An (optional) character vector containing the (co)variance component names.
vech: A vector of (co)variance parameters.
skeleton: An example structure to map vech onto.
thetaG, thetaR: A vector indexing the G-structure or R-structure components, respectively.
sigma2e: A numeric estimate of the factored out residual variance from the mixed model equations (i.e., the lambda scale) σe2.
object: An object of class gremlin .
Returns
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 vector indexing the G-structure components.
thetaR: A vector indexing 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.
Details
stTrans: Transform start parameters into lower triangle matrices of class dsCMatrix.
conTrans: Transformation of starting constraints to correct format.
start2theta: Converts lists of starting values for (co)variance parameters to a theta object used to structure the (co)variance components within gremlin.
matlist2vech: Converts a list of (co)variance parameter matrices to a vector with a skel attribute.
vech2matlist: Converts a vector of (co)variance parameters to a list of covariance matrices.
theta2nu_trans: Transforms 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_trans: Back transformation from theta2nu_trans: exponentiates the diagonal elements of each matrix then calculates the cross-product.
theta2nu_lambda: Transformation that factors out a residual variance so that nu contains the lambda parameterization: ratios of variance parameters with the residual variance.
nu2theta_lambda: Back transformation from theta2nu_lambda.
nuVar2thetaVar_lambda: Transformation of Sampling Variances from lambda Scale for theta.
nuAI2thetaAIinv_lambda: Transform AI matrix from lambda
Scale to AI-inverse of `theta`.
nu2theta_noTrans: Structures theta when not transformed.
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)