# rIG: Simulation of non-normal data In covsim: VITA, IG and PLSIM Simulation for Given Covariance and Marginals

 rIG R Documentation

## Simulation of non-normal data

### Description

Using the IG method to simulate non-normal data

### Usage

``````rIG(N, sigma.target, skewness, excesskurtosis, reps = 1, typeA = "triang")
``````

### Arguments

 `N` Number of observations to simulate. `sigma.target` Target population covariance matrix `skewness` Target skewness `excesskurtosis` Target excess kurtosis `reps` Number of simulated samples `typeA` Symmetrical or triangular (default) A matrix

### Value

A list of simulated samples

### Author(s)

Njål Foldnes (njal.foldnes@gmail.com)

### References

Foldnes, N. and Olson, U. H. (2016). A simple simulation technique for nonnormal data with prespecified skewness, kurtosis, and covariance matrix. Multivariate behavioral research, 51(2-3), 207-219

### Examples

``````set.seed(1234)
model <- '
# measurement model
ind60 =~ x1 + x2 + x3
dem60 =~ y1 + y2 + y3 + y4
dem65 =~ y5 + y6 + y7 + y8
# regressions
dem60 ~ ind60
dem65 ~ ind60 + dem60
# residual correlations
y1 ~~ y5
y2 ~~ y4 + y6
y3 ~~ y7
y4 ~~ y8
y6 ~~ y8'
fit  <- lavaan::sem(model, data=lavaan::PoliticalDemocracy)
population.sigma <- lavaan::lavInspect(fit, "sigma.hat")
population.skew  <- c(0, 0, 0, 0, 1, 1, 1, 1, 2,2,2 )
population.excesskurt <- c( 1 , 1, 1, 1, 3, 3, 3, 3, 15, 15, 15)
my.samples <- rIG(N=10^3, sigma=population.sigma,
skewness=population.skew,
excesskurt=population.excesskurt,
reps=5)
``````

covsim documentation built on June 22, 2024, 9:32 a.m.