View source: R/emxMatrixBuilders.R

emxCovariances | R Documentation |

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

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

`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. |

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.

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.

emxFactorModel, emxGrowthModel

# 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)

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.