Learn R Programming

semPower (version 2.1.1)

genData: genData

Description

Generates random data from population variance-covariance matrix and population means, either from a multivariate normal distribution, or using one of various approaches to generate non-normal data.

Usage

genData(
  N = NULL,
  Sigma = NULL,
  mu = NULL,
  nSets = 1,
  gIdx = NULL,
  modelH0 = NULL,
  simOptions = NULL
)

Value

Returns the generated data

Arguments

N

sample size.

Sigma

population covariance matrix.

mu

population means.

nSets

number of data sets to generate

gIdx

if not NULL, add gIdx as numeric group index as additional variable to generated data

modelH0

a lavaan model string, only used to determine the number of factors when type = 'RK'

simOptions

additional arguments specifying the data generation routine

Examples

Run this code
if (FALSE) {
gen <- semPower.genSigma(Phi = .2, loadings = list(rep(.5, 3), rep(.7, 3)))
data <- genData(N = 500, Sigma = gen$Sigma) 
}

Run the code above in your browser using DataLab