xmu_gsem_prepare_WLS: Prepare Data and Weight Matrices for GenomicSEM WLS/DWLS

View source: R/xmuGSEM.R

xmu_gsem_prepare_WLSR Documentation

Prepare Data and Weight Matrices for GenomicSEM WLS/DWLS

Description

Subsets, smooths, and packages the genetic covariance (S) and sampling covariance (V) matrices into OpenMx-compatible inputs for mxFitFunctionWLS.

Usage

xmu_gsem_prepare_WLS(
  covstruc = NULL,
  keep_vars,
  estimation = "DWLS",
  smooth = TRUE,
  S = NULL,
  V = NULL
)

Arguments

covstruc

A list containing the genetic covariance matrix ⁠$S⁠ and its asymptotic covariance ⁠$V⁠.

keep_vars

Character vector of traits to retain. Order must match model manifestVars.

estimation

Character string. Either "DWLS" (default), "WLS", or "ULS".

smooth

Logical. Should S and V be smoothed to nearest positive definite matrices if necessary? (Default TRUE).

Value

A list containing:

S

The subsetted, optionally smoothed genetic covariance matrix.

V_omx

The subsetted, optionally smoothed sampling covariance matrix, formatted for OpenMx.

W_omx

The weight matrix for OpenMx (diag(1/diag(V)) for DWLS, solve(V) for WLS, identity for ULS).

triage

The raw output from xmu_gsem_triage detailing what smoothing occurred.

keep_vars

The valid subset of keep_vars actually processed.


umx documentation built on Oct. 11, 2026, 5:07 p.m.