View source: R/calculateNIunitWeights.R
calculateNIunitWeights | R Documentation |
Returns NIunit weights, i.e. weight factors used in the calculation of indices for a set of NIunits.
calculateNIunitWeights(
BSunits = NULL,
NIunits = NULL,
awbs = TRUE,
awBSunit = NULL
)
BSunits |
character vector with the names of all BSunits included in the calculation. |
NIunits |
integer, |
awbs |
logical flag: should weights be based on the BSunit variable
|
awBSunit |
numeric vector containing the BSunit variable used to calculate
weights. Required if |
The Nature index and many thematic indices are weighted averages of indicator
observations. NIunit (area) weights (Wa
) are relevant when an index is
calculated for an NIunit consisting of more than one BSunit. They determine
the relative weight given to each BSunit in the weighted average.
NIunit weights are calculated a priori, i.e. they do not depend on the
observations' values. In the Norwegian implementation of the Nature Index
(NI
), NIunit weights are based on the area the major habitat in
question covers in each BSunit. An alternative is to use the total area or
another quality of BSunits. Wa
for a BSunit is the relevant area
divided by the corresponding total area of the aggregated NIunit. BSunits
outside the aggregate receive weights equal zero.
Usually, the Nature index and thematic indices are calculated for a set of NIunits simultaniously, where each unit consists of from one to all BSunits selected from a fixed set of BSunits. The function calculate NIunit weights for the whole set of NIunits.
A numeric BSunit x NIunit matrix x
, with weights per BSunit
for each NIunit, and where colSums(x) = rep(1,ncol)
.
Bård Pedersen
calculateBSunitWeights
and calculateWeights
.
The vignette NatureIndexCalculation
gives a complete description
of the framework for calculating weights for the Nature index.
# Test data
NIunits <- cbind(c(1,1,1,1),c(1,1,0,0),c(1,0,0,0),c(1,0,1,1),c(0,0,0,1))
BSunitNames <- c("bs1","bs2","bs3","bs4")
NIunitNames <- c("All units","Two units","Unit 1","Some units","Unit 4")
dimnames(NIunits) <- list(BSunitNames,NIunitNames)
awBSunit <- runif(4)*1000
# Default calculation:
x <- calculateNIunitWeights(BSunits = BSunitNames, NIunits = NIunits, awBSunit = awBSunit)
x
colSums(x)
# Equal weighting of BSunits:
calculateNIunitWeights(BSunits = BSunitNames, NIunits = NIunits, awbs = FALSE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.