emxCovariances: Create a set of covariances

View source: R/emxMatrixBuilders.R

emxCovariancesR Documentation

Create a set of covariances

Description

This function creates a covariance matrix as an MxMatrix or MxPath object.

Usage

emxCovariances(x, values, free, path=FALSE, type, name='Variances')

Arguments

x

character vector. The names of the variables for which covariances are created.

values

numeric vector. See Details.

free

logical vector. See Details.

path

logical. Whether to return the MxPath object instead of the MxMatrix.

type

character. The kind of covariance structure to create. See Details.

name

The name of the matrix created.

Details

Possible values for the type argument are 'independent', 'full', and 'corr'. When type='independent', the remaining arguments are passes to emxResiduals. The values and free arguments are only used when the type argument is 'independent'. For all other cases, they are ignored.

When type='full', a full covariance matrix is created. That is, a symmetric matrix is created with all unique elements freely estimated. The starting values for the variances are all 1; for the covariances, all 0.5.

When type='corr', a full correlation matrix is created. That is, a symmetric matrix is created with all unique elements not on the diagonal freely estimated. The starting values for the correlations are all 0.5. The variances are fixed at 1.

Value

Depending on the value of the path argument, either an MxMatrix or and MxPath object that can be inspected, modified, and/or included in MxModel objects.

See Also

emxFactorModel, emxGrowthModel

Examples

   
# Create a covariance matrix
require(EasyMx)
manVars <- paste0('x', 1:6)
latVars <- paste0('F', 1:2)
emxCovariances(manVars, type='full')
emxCovariances(latVars, type='corr', path=TRUE)



EasyMx documentation built on Feb. 16, 2023, 7:27 p.m.