calculateNIunitWeights: NIunit Weights

View source: R/calculateNIunitWeights.R

calculateNIunitWeightsR Documentation

NIunit Weights

Description

Returns NIunit weights, i.e. weight factors used in the calculation of indices for a set of NIunits.

Usage

calculateNIunitWeights(
  BSunits = NULL,
  NIunits = NULL,
  awbs = TRUE,
  awBSunit = NULL
)

Arguments

BSunits

character vector with the names of all BSunits included in the calculation.

NIunits

integer, 0/1, BSunit x NIunit matrix. Each element NIunits[i,j] is a logical flag: Is BSunit i a member of NIunit j? 0 = FALSE, 1 = TRUE.

awbs

logical flag: should weights be based on the BSunit variable awBSunit (awbs = TRUE, default), or should all BSunits within an NIunit be given equal weight (awbs = FALSE)?

awBSunit

numeric vector containing the BSunit variable used to calculate weights. Required if awbs = TRUE.

Details

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.

Value

A numeric BSunit x NIunit matrix x, with weights per BSunit for each NIunit, and where colSums(x) = rep(1,ncol).

Author(s)

Bård Pedersen

See Also

calculateBSunitWeights and calculateWeights.
The vignette NatureIndexCalculation gives a complete description of the framework for calculating weights for the Nature index.

Examples

# 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)


NINAnor/NIcalc documentation built on Oct. 26, 2023, 9:37 a.m.