bindDist {simsem} | R Documentation |
Create a data distribution object.
Description
Create a data distribution object. There are two ways to specify nonnormal data-generation model. To create nonnormal data by the copula method, margins
and ...
arguments are required. To create data by Vale and Maurelli's method, skewness
and/or kurtosis
arguments are required.
Usage
bindDist(margins = NULL, ..., p = NULL, keepScale = TRUE, reverse = FALSE,
copula = NULL, skewness = NULL, kurtosis = NULL)
Arguments
margins |
A character vector specifying all the marginal distributions. The characters in argument margins are used to construct density, distribution, and quantile function names. For example, |
... |
A list whose each component is a list of named components, giving the parameter values of the marginal distributions. See the description of |
p |
Number of variables. If only one distribution object is listed, the |
keepScale |
A vector representing whether each variable is transformed its mean and standard deviation or not. If TRUE, transform back to retain the mean and standard deviation of a variable equal to the model implied mean and standard deviation (with sampling error) |
reverse |
A vector representing whether each variable is mirrored or not. If |
copula |
A copula class that represents the multivariate distribution, such as |
skewness |
A vector of skewness of each variable. The Vale & Maurelli (1983) method is used in data generation. |
kurtosis |
A vector of (excessive) kurtosis of each variable. The Vale & Maurelli (1983) method is used in data generation. |
Value
SimDataDist
that saves analysis result from simulate data.
Author(s)
Sunthud Pornprasertmanit (psunthud@gmail.com)
References
Mair, P., Satorra, A., & Bentler, P. M. (2012). Generating nonnormal multivariate data using copulas: Applications to SEM. Multivariate Behavioral Research, 47, 547-565.
Vale, C. D. & Maurelli, V. A. (1983) Simulating multivariate nonormal distributions. Psychometrika, 48, 465-471.
See Also
-
SimResult
for the type of resulting object
Examples
# Create data based on Vale and Maurelli's method by specifying skewness and kurtosis
dist <- bindDist(skewness = c(0, -2, 2), kurtosis = c(0, 8, 4))
## Not run:
library(copula)
# Create three-dimensional distribution by gaussian copula with
# the following marginal distributions
# 1. t-distribution with df = 2
# 2. chi-square distribution with df = 3
# 3. normal distribution with mean = 0 and sd = 1
# Setting the attribute of each marginal distribution
d1 <- list(df=2)
d2 <- list(df=3)
d3 <- list(mean=0, sd=1)
# Create a data distribution object by setting the names of each distribution
# and their arguments
dist <- bindDist(c("t", "chisq", "norm"), d1, d2, d3)
# Create data by using Gumbel Copula as the multivariate distribution
dist <- bindDist(c("t", "chisq", "norm"), d1, d2, d3, copula = gumbelCopula(2, dim = 3))
# Reverse the direction of chi-square distribution from positively skew to negatively skew
dist <- bindDist(c("t", "chisq", "norm"), d1, d2, d3, copula = gumbelCopula(2, dim = 3),
reverse = c(FALSE, TRUE, FALSE))
## End(Not run)