Package 'mnonr'

Title: A Generator of Multivariate Non-Normal Random Numbers
Description: A data generator of multivariate non-normal data in R. It combines two different methods to generate non-normal data, one with user-specified multivariate skewness and kurtosis (more details can be found in the paper: Qu, Liu, & Zhang, 2019 <doi:10.3758/s13428-019-01291-5>), and the other with the given marginal skewness and kurtosis. The latter one is the widely-used Vale and Maurelli's method. It also contains a function to calculate univariate and multivariate (Mardia's Test) skew and kurtosis.
Authors: Wen Qu and Zhiyong Zhang
Maintainer: Wen Qu <[email protected]>
License: GPL-2 | GPL-3
Version: 1.0.0
Built: 2024-10-31 22:13:11 UTC
Source: CRAN

Help Index


Univariate and Multivariate skewness and kurtosis checker

Description

Univariate and Multivariate skewness and kurtosis checker

Usage

mardia(x, na.rm = TRUE)

Arguments

x

A data matrix

na.rm

An indication of the missing data, the default value is True

Value

Data information: sample size and number of variables. The marginal and multivariate test (Mardia's Test) of skewness and kurtosis.


Multivariate Non-normal Random Number Generator based on Multivariate Measures

Description

Multivariate Non-normal Random Number Generator based on Multivariate Measures

Usage

mnonr(n, p, ms, mk, Sigma, initial = NULL)

Arguments

n

Sample size

p

Number of variables

ms

A value of multivariate skewness

mk

A value of multivariate kurtosis

Sigma

A covariance matrix (In this function, the generated data are standarized. A correlation matrix is equal to its corresponding covariance matrix.)

initial

A vector with 3 numbers for initial polynominal coefficients' (b,c,d). The default setting is (0.9,0.4,0).

Value

A data matrix (multivariate data)

Examples

mnonr::mnonr(n=10000,p=2,ms=3,mk=61,Sigma=matrix(c(1,0.5,0.5,1),2,2),initial=NULL)

Multivariate Non-normal Random Number Generator based on Marginal Measures (Vale and Maurelli's method)

Description

Generate Multivariate Non-normal Data using Vale and Maurelli (1983) method. The codes are copied from mvrnonnorm function in the semTools package.

Usage

unonr(n, mu, Sigma, skewness = NULL, kurtosis = NULL, empirical = FALSE)

Arguments

n

Sample size

mu

A mean vector

Sigma

A covariance matrix

skewness

A skewness vector

kurtosis

A kurtosis vector

empirical

If TRUE, mu and Sigma specify the empirical not population mean and covariance matrix

Value

A data matrix (multivariate data)

References

Vale, C. D. & Maurelli, V. A. (1983) Simulating multivariate nonormal distributions. Psychometrika, 48, 465-471.

Examples

unonr(1000, c(1, 2), matrix(c(10, 2, 2, 5), 2, 2), skewness = c(1, 2), kurtosis = c(3, 8))