sampleobs | R Documentation |
sampleobs
returns nsim
random draws from a two-parameter
probability distribution specified by the function's arguments.
sampleobs(nsim = 99, distrib, mu, sig)
nsim |
double, length = 1, number of draws (simulations) |
distrib |
character, length = 1, distribution family, i.e. one of
|
mu |
double, length = 1, parameter 1 of model distribution |
sig |
double, length = 1, parameter 2 of model distribution |
sampleobs
samples from a single distribution among a predetermined set
of distribution families. The predetermined set consists of the gamma-,
lognormal-, truncated normal-, Weibull-, zero-inflated exponential-,
negative binomial-, Poisson-, and zero-inflated Poisson distribution families.
The lower bound in the truncated normal distribution is always zero, while the
upper bound is infinity. With these restrictions all distributions in the set
have two parameters, except the Poisson with only one parameter.
sampleobs
is a utility function adapted to the mathematical framework
for calculating the nature index.
sampleobs
calls random generation functions rLOGNO, rWEI, qGA, rPO,
rNBII, rZIP in the gamlss.dist package, rtnorm in the msm package, runif and
rexp in the stats package.
double vector, length = nsim
, nsim
random draws from
model specified by distrib
, mu
, and sig
.
Nigel Yoccoz and Bård Pedersen
sampleObsMat
nn <- 100000
hist(sampleobs(nsim = nn, distrib="Gamma", mu = 1, sig = 0.5), breaks=50)
hist(sampleobs(nsim = nn, distrib="LogNormal", mu = -2, sig = 0.5), breaks=50)
hist(sampleobs(nsim = nn, distrib="TruncNormal", mu = -2, sig = 0.5), breaks=50)
hist(sampleobs(nsim = nn, distrib="Weibull", mu = 2, sig = 7), breaks=50)
hist(sampleobs(nsim = nn, distrib="ZIExponential", mu = 0.2, sig = 0.5),
breaks=50)
hist(sampleobs(nsim = nn, distrib="NegBinom", mu = 4, sig = 1))
hist(sampleobs(nsim = nn, distrib="Poisson", mu = 4, sig = NA))
hist(sampleobs(nsim = nn, distrib="ZIP", mu = 10, sig = 0.25))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.