dist.spec can specify a distribution but offers no way to draw samples from one. Callers have to pull the native parameters and dispatch to the base r* functions themselves, duplicating the family and parameter-name knowledge dist.spec already holds:
pars <- get_parameters(x)
switch(get_distribution(x),
lognormal = rlnorm(n, pars$meanlog, pars$sdlog),
gamma = rgamma(n, pars$shape, pars$rate))
Proposal: a sample_dist(x, n) that dispatches on get_distribution(x), and errors if any parameter is a prior rather than a fixed number. Fixed-parameter case only to start.
dist.spec can specify a distribution but offers no way to draw samples from one. Callers have to pull the native parameters and dispatch to the base
r*functions themselves, duplicating the family and parameter-name knowledge dist.spec already holds:Proposal: a
sample_dist(x, n)that dispatches onget_distribution(x), and errors if any parameter is a prior rather than a fixed number. Fixed-parameter case only to start.