rPLSIM: Simulation of non-normal data

View source: R/PLSIM.R

rPLSIMR Documentation

Simulation of non-normal data

Description

Backward-compatible wrapper that combines calibrate_plsim and simulate in one call. New code should prefer the calibrate/simulate split so the (expensive) pairwise calibration can be reused.

Usage

rPLSIM(
  N,
  sigma.target,
  skewness,
  excesskurtosis,
  reps = 1,
  numsegments = 4,
  gammalist = NULL,
  monot = FALSE,
  verbose = TRUE
)

Arguments

N

Number of observations to simulate.

sigma.target

Target population covariance matrix.

skewness

Target skewness vector.

excesskurtosis

Target excess kurtosis vector.

reps

Number of simulated samples.

numsegments

The number of line segments in each marginal.

gammalist

A list of breakpoints in each margin.

monot

If TRUE, piecewise linear functions are forced to be monotonous. The implied copula is then normal.

verbose

If TRUE, prints calibration progress.

Value

A list with two elements. First element: the list of simulated samples. Second element: the fitted piecewise linear functions and the intermediate correlations matrix.

Author(s)

Njål Foldnes (njal.foldnes@gmail.com)

References

Foldnes, N. and Grønneberg S. (2021). Non-normal data simulation using piecewise linear transforms.Under review.

Examples

set.seed(1)
sigma.target  <- cov(MASS::mvrnorm(5, rep(0,3), diag(3)))
res  <- covsim::rPLSIM(10^5, sigma.target, skewness=rep(1,3), excesskurtosis=rep(4,3))
my.sample  <- res[[1]][[1]]

covsim documentation built on Oct. 29, 2026, 5:06 p.m.