quanttrans: Quantile Transformations

q_factorR Documentation

Quantile Transformations

Description

A collection of functions that transform the margins of a Latin hypercube sample in non-standard ways

Usage

q_factor(p, fact)

q_integer(p, a, b)

q_dirichlet(X, alpha)

Arguments

p

a vector of LHS samples on (0,1)

fact

a factor or categorical variable. Ordered and un-ordered variables are allowed.

a

a minimum integer

b

a maximum integer

X

multiple columns of an LHS sample on (0,1)

alpha

Dirichlet distribution parameters. All alpha >= 1 The marginal mean probability of the Dirichlet distribution is given by alpha[i] / sum(alpha)

Details

qdirichlet is not an exact quantile function since the quantile of a multivariate distribution is not unique. qdirichlet is also not the independent quantiles of the marginal distributions since those quantiles do not sum to one. qdirichlet is the quantile of the underlying gamma functions, normalized. This has been tested to show that qdirichlet approximates the Dirichlet distribution well and creates the correct marginal means and variances when using a Latin hypercube sample

q_factor divides the [0,1] interval into nlevel(fact) equal sections and assigns values in those sections to the factor level.

Value

the transformed column or columns

Examples

X <- randomLHS(20, 6)
Y <- X
Y[,1] <- qnorm(X[,1], 2, 0.5)
Y[,2] <- q_factor(X[,2], factor(LETTERS[c(1,3,5,7,8)]))
Y[,3] <- q_integer(X[,3], 5, 17)
Y[,4:6] <- q_dirichlet(X[,4:6], c(2,3,4))

bertcarnell/lhs documentation built on Feb. 3, 2024, 7:46 p.m.