scaleObsMat | R Documentation |
scaleObsMat
scales a set of indicator observations according to chosen
scaling model ("Low"
or "Max"
) and associated reference values.
scaleObsMat(
bootmat = NULL,
refmat = NULL,
scalingModel = NULL,
truncAtRef = TRUE
)
bootmat |
double matrix |
refmat |
double matrix |
scalingModel |
character |
truncAtRef |
logical flag: whether to truncate scaled indicator
observations at the reference value |
Each indicator observation and reference value is assumed to be entered as
nsim
draws from their respective distributions. The sets of
indicator observations and reference values are both entered as
nObs x nsim
matrices, with identical row names.
Scaling models are specific for each observation. They should be entered as a
named vector of scaling model codes "Low"
or "Max"
, with
length = nObs
and names identical to the row names of
indicator observation and reference values matrices.
double matrix dim=nObs x nsim
of scaled indicator observations.
Bård Pedersen
The vignette NatureIndexCalculation
for a description of the
framework for calculating the Nature index
## Not run:
# Example based on the themeData set for 2019
bootmat <- sampleObsMat(ICunitId = themeData$indicatorValues[["2019"]]$ICunitId,
value = themeData$indicatorValues[["2019"]]$expectedValue,
distrib = themeData$indicatorValues[["2019"]]$distributionFamilyName,
mu = themeData$indicatorValues[["2019"]]$distParameter1,
sig = themeData$indicatorValues[["2019"]]$distParameter2,
customDistribution = themeData$indicatorValues[["2019"]]$customDistribution,
imputations = NULL,
obsMethod = "sample",
obsType = "tradObs",
nsim = 10)
refmat <- sampleObsMat( ICunitId = themeData$referenceValues$ICunitId,
value = themeData$referenceValues$expectedValue,
distrib = themeData$referenceValues$distributionFamilyName,
mu = themeData$referenceValues$distParameter1,
sig = themeData$referenceValues$distParameter2,
customDistribution = themeData$referenceValues$customDistribution,
imputations = NULL,
obsMethod = "constant",
obsType = "tradObs",
nsim = 10)
scaleVec <- themeData$indicatorValues[["2019"]]$scalingModel
names(scaleVec) <- themeData$indicatorValues[["2019"]]$ICunitId
scaleVec <- scaleVec[dimnames(bootmat)[[1]]]
scaledBootmat <- scaleObsMat(bootmat = bootmat,
refmat = refmat,
scalingModel = scaleVec)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.