Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

umxHetCor

Create a matrix of correlations for variables of diverse types (binary, ordinal, continuous)


Description

umxHetCor is a helper to:

  1. return just the correlations from John Fox's polycor::hetcor function

  2. If you give it a covariance matrix, return the nearest positive-definite correlation matrix.

Usage

umxHetCor(
  data,
  ML = FALSE,
  use = c("pairwise.complete.obs", "complete.obs"),
  treatAllAsFactor = FALSE,
  verbose = FALSE,
  return = c("correlations", "hetcor object"),
  std.err = FALSE
)

Arguments

data

A data.frame() of columns for which to compute heterochoric correlations. OR an existing covariance matrix.

ML

Whether to use Maximum likelihood computation of correlations (default = FALSE)

use

How to handle missing data: Default= "pairwise.complete.obs". Alternative ="complete.obs".

treatAllAsFactor

Whether to treat all columns as factors, whether they are or not (Default = FALSE)

verbose

How much to tell the user about what was done.

return

Return just the correlations (default) or the hetcor object (contains, method, SEs etc.)

std.err

Compute the SEs? (default = FALSE)

Value

  • A matrix of correlations

See Also

Examples

umxHetCor(mtcars[,c("mpg", "am")])
umxHetCor(mtcars[,c("mpg", "am")], treatAllAsFactor = TRUE, verbose = TRUE)

umx

Structural Equation Modeling and Twin Modeling in R

v4.10.10
GPL-3
Authors
Timothy C. Bates [aut, cre] (<https://orcid.org/0000-0002-1153-9007>), Gillespie Nathan [wit], Michael Zakharin [wit], Brenton Wiernik [ctb], Joshua N. Pritikin [ctb], Michael C. Neale [ctb], Hermine Maes [ctb]
Initial release
2021-11-30

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.