sampleObsMat | R Documentation |
sampleObsMat
returns nsim
bootstrap samples of a set of
indicator observations from the same year or reference values.
sampleObsMat(
ICunitId = NULL,
value = NULL,
distrib = NULL,
mu = NULL,
sig = NULL,
customDistribution = NULL,
imputations = NULL,
obsMethod = "sample",
obsType = NULL,
impYear = NULL,
nsim = 1000
)
ICunitId |
integer vector |
value |
numeric vector with expected values |
distrib |
character vector with names of model distributions |
mu |
numeric vector with parameter 1 of model distribution |
sig |
numeric vector with parameter 2 of model distribution |
customDistribution |
list of distribution objects and |
imputations |
optional list of class |
obsMethod |
string, either |
obsType |
character vector with observation types. Valid elements are:
|
impYear |
character, year in question. The parameter is only relevant
when the data set includes imputed values. Used to identify the correct
elements in |
nsim |
integer - number of bootstrap simulations, default is 1000. |
Bootstrap samples consist of either nsim
random draws from a set of
probability distributions, or nsim
copies of the elements of
value
, depending on the parameter obsMethod
.
Probability distributions are either two-parameter, non-negative probability
distributions given by vectors distrib
, mu
and sig
, or
distribution objects in the list customDistribution
,
or a distribution of nsim
sampled, imputed values in imputes
.
sampleObsMat
presumes that the set of probability distributions only
includes the truncated normal-, lognormal-, weibull-, gamma-, zero-inflated
exponential, poisson-, negative binomial-, and zero-inflated poisson
distributions. The lower bound in the truncated normal distribution is always
zero, while the upper bound is infinity.
sampleObsMat
is a utility function adapted to the mathematical
framework for calculating the nature index.
sampleObsMat
calls functions sampleobs
and
sampleDistribution
which do the random draws.
numeric matrix, dim = c(length(values), nsim)
, nsim
bootstrap samples of the set of indicator observations or reference values.
Bård Pedersen
sampleobs
, sampleDistribution
x <- themeData$indicatorValues$`2019`[11:20,]
sampleObsMat(ICunitId = x$ICunitId,
value = x$expectedValue,
distrib = x$distributionFamilyName,
mu = x$distParameter1,
sig = x$distParameter2,
customDistribution = x$customDistribution,
obsMethod = "sample",
obsType = "tradObs",
nsim = 5)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.