Learn R Programming

umx (version 1.4.0)

umx_cov_diag: umx_cov_diag

Description

Helper to get variances from a df that might contain some non-numeric columns. Values at non-numeric columns are set to the value passed in as ordVar.

Usage

umx_cov_diag(df, ordVar = 1, format = c("diag", "Full", "Lower"), use = c("complete.obs", "pairwise.complete.obs", "everything", "all.obs", "na.or.complete"))

Arguments

df
a dataframe of raw data from which to get variances.
ordVar
The value to return at any ordinal columns (defaults to 1)
format
to return: options are c("diag", "Full", "Lower"). Defaults to diag: a vector of variances
use
passed to cov - defaults to "complete.obs" (other options are in the function )

Value

- mxModel

References

- http://tbates.github.io

See Also

Other Building Functions: umx_check_names

Examples

Run this code
tmp = mtcars[,1:4]
tmp$cyl = ordered(mtcars$cyl) # ordered factor
tmp$hp  = ordered(mtcars$hp)  # binary factor
umx_cov_diag(tmp, ordVar = 1, use = "pair")
tmp2 = tmp[, c(1,3)]
umx_cov_diag(tmp2)
umx_cov_diag(tmp2, format = "Full")

Run the code above in your browser using DataLab