rngh:

Usage Arguments Examples

Usage

1
rngh(n, rho = 0, p = 2, g = 0, h = 0, ADJ = TRUE)

Arguments

n
rho
p
g
h
ADJ

Examples

 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
##---- Should be DIRECTLY executable !! ----
##-- ==>  Define data, use random,
##--	or do  help(data=index)  for the standard data sets.

## The function is currently defined as
function (n, rho = 0, p = 2, g = 0, h = 0, ADJ = TRUE) 
{
    library(MASS)
    if (ADJ) {
        adjrho = rngh.sub(n, g, h, rho)$rho.adjusted
        rho = adjrho
        print(paste("Adjusted rho", rho))
    }
    cmat <- matrix(rho, p, p)
    diag(cmat) <- 1
    x = mvrnorm(n = n, mu = rep(0, p), Sigma = cmat)
    for (i in 1:p) {
        if (g > 0) {
            x[, i] <- (exp(g * x[, i]) - 1) * exp(h * x[, i]^2/2)/g
        }
        if (g == 0) 
            x[, i] <- x[, i] * exp(h * x[, i]^2/2)
    }
    x
  }

musto101/wilcox_R documentation built on May 23, 2019, 10:52 a.m.