ctsem's covariance matrices – T0VAR, DIFFUSION,
MANIFESTVAR, and the population spreads RAWPOPVAR and
RAWPOPVAR_<idname> – are specified as a lower triangle: standard
deviations on the diagonal, and below it coordinates that the model's
covmattransform turns into correlations. Except for two variables
under 'z', where a coordinate is Fisher's z, what one coordinate
yields depends on the others, so the cells for a given covariance are not
something to work out by hand. ctCov() computes them.
Arguments
- cov
A symmetric positive definite covariance matrix.
- covmattransform
The construction to write the cells for:
'z'(the default, and whatctModeluses),'rawcorr'or'cholesky'. ActCov()matrix assigned into a model is rewritten for that model's own construction, so this matters only when the cells are read directly.
Value
The cells, a lower triangular numeric matrix of class ctCov,
with the covariance as attribute covariance. 'rawcorr' cannot
reach every correlation matrix, and a covariance it cannot represent is
refused.
Details
Pass the result wherever a fixed matrix goes: ctModel(DIFFUSION =
ctCov(S)), m$matrices$T0VAR <- ctCov(S), or m$RAWPOPVAR <-
ctCov(S), in every case for the whole matrix. The model keeps the
covariance as well as the cells, so the matrix keeps its meaning if
covmattransform is changed afterwards, and the R generator of
ctGenerate – which reads covariance cells as a Cholesky
factor – generates from the same covariance as the julia one. A cell edited
by hand afterwards replaces what ctCov() wrote.
For RAWPOPVAR, the covariance is that of the raw, untransformed
parameters across subjects (or groups, for RAWPOPVAR_<idname>),
which is the scale a fit reports it on.