runif_corr: Simulate correlated uniform random variates

Description Usage Arguments Details Value

View source: R/simulation.R

Description

Simulate multiple iid correlated uniform random variates.

Usage

1
runif_corr(n, corr, min = -1, max = 1)

Arguments

n

Number of random variates to generate.

corr

Correlation between the random variates. Must be a p x p diagonal matrix, with 1 on the diagonal.

min

lower limit of the distribution

max

upper limit of the distribution

Details

First, with a given correlation matrix corr, we simulate

(X_i1, ..., X_ip) ~ MVN(0, corr)

for i = 1, 2, ... n. Then, we obtain

(U_i1, ..., U_ip) = (F(X_i1), ..., F_(X_ip)),

where F is the standard normal PDF (note marginally, X_i1 ~ N(0, 1) since corr is assumed to have 1 on the diagonals). Then, the U will marginally be uniformly distributed on (0, 1), with some correlation. Finally, we transform U_ij using (max - min) * U_ij + min to get a random variable uniformly distributed on (min, max).

Value

n x p matrix of correlated uniform random variates, where each row is iid.


shiandy/bst235project documentation built on May 14, 2019, 2:01 a.m.