nnig_sim.Rd
Simulates multivariate linearly related non-normally distributed variables
(Foldnes & Olsson, 2016). For marginal distributions, skewness and (excess) kurtosis
values are provided and the values are simulated according to the Fleishman
power transformation (Fleishman, 1978; see fleishman_sim
).
The function nnig_sim
simulates data from a multivariate random variable
\(\bold{Y}\) which is related to a number of independent variables \(\bold{X}\)
(independent generators; Foldnes & Olsson, 2016)
which are Fleishman power normally distributed. In detail, it holds that
\(\bold{Y}=\bold{\mu} + \bold{A} \bold{X}\) where the covariance matrix
\(\bold{\Sigma}\) is decomposed according to a Cholesky decomposition
\(\bold{\Sigma}=\bold{A} \bold{A}^T\).
# determine coefficients
nnig_coef(mean=NULL, Sigma, skew, kurt)
# simulate values
nnig_sim(N, coef)
Vector of means. The default is a vector containing zero means.
Covariance matrix
Vector of skewness values
Vector of (excess) kurtosis values
Number of cases
List of parameters generated by nnig_coef
A list of parameter values (nnig_coef
) or a data frame with
simulated values (nnig_sim
).
Fleishman, A. I. (1978). A method for simulating non-normal distributions. Psychometrika, 43(4), 521-532. doi:10.1007/BF02293811
Foldnes, N., & Olsson, 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. doi:10.1080/00273171.2015.1133274
Vale, D. C., & Maurelli, V. A. (1983). Simulating multivariate nonnormal distributions. Psychometrika, 48(3), 465-471. doi:10.1007/BF02293687
See fungible::monte1
for simulating multivariate linearly related
non-normally distributed variables generated by the method of Vale and Morelli (1983).
See also the MultiVarMI::MVNcorr
function in the MultiVarMI package
and the SimMultiCorrData package.
The MultiVarMI also includes an imputation function MultiVarMI::MI
for non-normally distributed variables.
if (FALSE) {
#############################################################################
# EXAMPLE 1: Simulating data with nnig_sim function
#############################################################################
#* define input parameters
Sigma <- matrix( c(1,.5, .2,
.5, 1,.7,
.2, .7, 1), 3, 3 )
skew <- c(0,1,1)
kurt <- c(1,3,3)
#* determine coefficients
coeff <- miceadds::nnig_coef( Sigma=Sigma, skew=skew, kurt=kurt )
print(coeff)
#* simulate data
set.seed(2018)
Y <- miceadds::nnig_sim( N=2000, coef=coeff)
#* check descriptive statistics
apply(Y, 2, TAM::weighted_skewness )
apply(Y, 2, TAM::weighted_kurtosis )
}