Given a data frame with one row per target, a dist column (or a dist
argument) naming a distribution, and columns for that distribution's
parameters, adds list columns holding the corresponding cdf, density,
quantile function and/or random generator. allocate() needs only the cdf
("p") and quantile function ("q").
Arguments
- df
data frame with one row per target. It must have a column for each parameter required by the distribution functions named in a
distcolumn or in thedistargument.- dist
character vector of length 1 or
nrow(df)giving distribution root names (or"distfromq"); required ifdfhas nodistcolumn.- trans
function of an outcome
xand parameters, pre-composed with thepanddfunctions. Use this for distributions whose support must be rescaled, such as a beta distribution on[x_min, x_max].- trans_inv
inverse of
trans, post-composed with theqandrfunctions.- transpars
parameters for
transandtrans_invthat are not columns ofdf.- types
which of
"p","d","q","r"to add.- fnames
names to give the added list columns.