nnig_sim | R Documentation |
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)
mean |
Vector of means. The default is a vector containing zero means. |
Sigma |
Covariance matrix |
skew |
Vector of skewness values |
kurt |
Vector of (excess) kurtosis values |
N |
Number of cases |
coef |
List of parameters generated by |
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. \Sexpr[results=rd]{tools:::Rd_expr_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. \Sexpr[results=rd]{tools:::Rd_expr_doi("10.1080/00273171.2015.1133274")}
Vale, D. C., & Maurelli, V. A. (1983). Simulating multivariate nonnormal distributions. Psychometrika, 48(3), 465-471. \Sexpr[results=rd]{tools:::Rd_expr_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.
## Not run:
#############################################################################
# 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 )
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.