File: mvrnonnorm.Rd

package info (click to toggle)
r-cran-semtools 0.5.7-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 3,204 kB
  • sloc: makefile: 2
file content (58 lines) | stat: -rw-r--r-- 2,042 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/mvrnonnorm.R
\name{mvrnonnorm}
\alias{mvrnonnorm}
\title{Generate Non-normal Data using Vale and Maurelli (1983) method}
\usage{
mvrnonnorm(n, mu, Sigma, skewness = NULL, kurtosis = NULL,
  empirical = FALSE)
}
\arguments{
\item{n}{Sample size}

\item{mu}{A mean vector. If elements are named, those will be used as
variable names in the returned data matrix.}

\item{Sigma}{A positive-definite symmetric matrix specifying the covariance
matrix of the variables. If rows or columns are named (and \code{mu} is
unnamed), those will be used as variable names in the returned data matrix.}

\item{skewness}{A vector of skewness of the variables}

\item{kurtosis}{A vector of excessive kurtosis of the variables}

\item{empirical}{deprecated, ignored.}
}
\value{
A data matrix
}
\description{
Generate Non-normal Data using Vale and Maurelli (1983) method. The function
is designed to be as similar as the popular \code{mvrnorm} function in the
\code{MASS} package. The codes are copied from \code{mvrnorm} function in
the \code{MASS} package for argument checking and \code{lavaan} package for
data generation using Vale and Maurelli (1983) method.
}
\examples{

set.seed(123)
mvrnonnorm(20, c(1, 2), matrix(c(10, 2, 2, 5), 2, 2),
	skewness = c(5, 2), kurtosis = c(3, 3))
## again, with variable names specified in mu
set.seed(123)
mvrnonnorm(20, c(a = 1, b = 2), matrix(c(10, 2, 2, 5), 2, 2),
	skewness = c(5, 2), kurtosis = c(3, 3))

}
\references{
Vale, C. D. & Maurelli, V. A. (1983). Simulating multivariate
nonormal distributions. \emph{Psychometrika, 48}(3), 465--471.
\doi{10.1007/BF02293687}
}
\author{
The original function is the \code{\link[lavaan:simulateData]{lavaan::simulateData()}}
function written by Yves Rosseel in the \code{lavaan} package. The function
is adjusted for a convenient usage by Sunthud Pornprasertmanit
(\email{psunthud@gmail.com}). Terrence D. Jorgensen added the feature to
retain variable names from \code{mu} or \code{Sigma}.
}