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

umx_make_fake_data

umx_make_fake_data


Description

This function takes as argument an existing dataset, which must be either a matrix or a data frame. Each column of the dataset must consist either of numeric variables or ordered factors. When one or more ordered factors are included, then a heterogeneous correlation matrix is computed using John Fox's polycor package. Pairwise complete observations are used for all covariances, and the exact pattern of missing data present in the input is placed in the output, provided a new sample size is not requested. Warnings from the polycor::hetcor function are suppressed.

Usage

umx_make_fake_data(
  dataset,
  digits = 2,
  n = NA,
  use.names = TRUE,
  use.levels = TRUE,
  use.miss = TRUE,
  mvt.method = "eigen",
  het.ML = FALSE,
  het.suppress = TRUE
)

Arguments

dataset

The original dataset of which to make a simulacrum

digits

= Round the data to the requested digits (default = 2)

n

Number of rows to generate (NA = all rows in dataset)

use.names

Whether to name the variables (default = TRUE)

use.levels

= Whether to use existing levels (default = TRUE)

use.miss

Whether to have data missing as in original (defaults to TRUE)

mvt.method

= Passed to hetcor (default = "eigen")

het.ML

= Passed to hetcor (default = FALSE)

het.suppress

Passed to hetcor (default = TRUE)

Value

- new dataframe

See Also

[OpenMx::mxGenerateData()]

Examples

fakeCars = umx_make_fake_data(mtcars)

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.