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, "norm" can be used to specify marginal distribution, because "dnorm", "pnorm", and "qnorm" are all available. A user-defined distribution or other distributions can be used. For example, "gl" function in the "gld" package can be used to represent the generalized lambda distribution where "dgl", "pgl", and "qgl" are available. See the description of margins attribute of the Mvdc function for further details.

...

A list whose each component is a list of named components, giving the parameter values of the marginal distributions. See the description of paramMargins attribute of the Mvdc function for further details.

p

Number of variables. If only one distribution object is listed, the p will make the same distribution objects for all variables.

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 TRUE, reverse the distribution of a variable (e.g., from positive skewed to negative skewed. If one logical value is specified, it will apply to all variables.

copula

A copula class that represents the multivariate distribution, such as ellipCopula, normalCopula, or archmCopula. When this copula argument is specified, the data-transformation method from Mair, Satorra, and Bentler (2012) is used. If this copula argument is not specified, the naive Gaussian copula is used such that the correlation matrix is direct applied to the multivariate Gaussian copula. The correlation matrix will be equivalent to the Spearman's correlation (rank correlation) of the resulting data.

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

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)

[Package simsem version 0.5-16 Index]