q_factor | R Documentation |
A collection of functions that transform the margins of a Latin hypercube sample in non-standard ways
q_factor(p, fact)
q_integer(p, a, b)
q_dirichlet(X, alpha)
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 |
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.
the transformed column or columns
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))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.