wtedmean: wtedmean calculates the weighted mean of a set of values and...

View source: R/rutils.R

wtedmeanR Documentation

wtedmean calculates the weighted mean of a set of values and weights

Description

wtedmean solves the problem of calculating a weighted mean value from a set of values with different weights. Within the aMSE this is common when trying to summarize across populations within an SAU or summarize SAU within a zone by finding a mean value weighted by the respective catch from each related population or SAU.

Usage

wtedmean(x, wts)

Arguments

x

the values whose weighted mean is wanted

wts

the weights to use, often a set of catches

Value

a single real number

Examples

saucpue <- c(91.0,85.5,88.4,95.2)
saucatch <- c(42.0,102.3,75.0,112.0)
wtedmean(saucpue,saucatch)
saucatch/sum(saucatch)  # the relative weights

haddonm/codeutils documentation built on April 15, 2024, 1:02 p.m.