rPrior: Sampling from a Prior Distribution

View source: R/rPrior.R

rPriorR Documentation

Sampling from a Prior Distribution

Description

Sampling from a prior distribution.

Usage

rPrior(n, copula, qmargins = qnorm, method = c("pseudo", "sobol"), ...)

Arguments

n

sample size, a positive integer.

copula

object of S4 class "Copula" for which the method rCopula() is available; see the R package copula.

qmargins

marginal quantile function or a list of length dim(x)[1] of such.

method

character string indicating the sampling method. If "sobol", then randomization "digital.shift" is used (pass seed via ... for reproducibilty; see the R package qrng).

...

additional arguments passed to method.

Value

(n, dim(copula))-matrix of samples.

Author(s)

Marius Hofert

Examples

library(gnn) # for being standalone

n <- 5
d <- 3
library(copula)
cop <- claytonCopula(2, dim = d)
X1 <- rPrior(n, copula = cop) # Clayton copula and N(0,1) margins
X2 <- rPrior(n, copula = cop, qmargins = qexp) # Exp(1) margins
X3 <- rPrior(n, copula = cop, qmargins = qexp, method = "sobol", seed = 271)
stopifnot(dim(X1) == c(n, d), dim(X2) == c(n, d), dim(X3) == c(n, d))

gnn documentation built on May 29, 2024, 6:13 a.m.

Related to rPrior in gnn...