Take n random samples from prior

get.sample(prior, n = NULL, p = NULL)

Arguments

prior

data.frame with distn, parama, and optionally paramb.

n

number of samples to return from a random sample of the rdistn family of functions (e.g. rnorm)

p

vector of quantiles from which to sample the distribution; typically pre-generated upstream in the workflow to be used by the qdistn family of functions (e.g. qnorm)

Value

vector with n random samples from prior

Details

Similar to the prior sample function pr.samp, except 1) it takes the prior as a named dataframe or list and it can return either a random sample of length n OR a sample from a quantile specified as p

See also

Examples

if (FALSE) { # \dontrun{
# return 1st through 99th quantile of standard normal distribution:
PEcAn.priors::get.sample(
   prior = data.frame(distn = 'norm', parama = 0, paramb = 1), 
   p = 1:99/100)
# return 100 random samples from standard normal distribution:
PEcAn.priors::get.sample(
   prior = data.frame(distn = 'norm', parama = 0, paramb = 1), 
   n = 100)
} # }