sd_wt: Function to calculate weighted standard deviation

Description Usage Arguments Value Examples

View source: R/sd_wt.r

Description

Calculates the standard deviation of a weighted sample set while propagating sample weights through the calculation.

Usage

1
sd_wt(x, w, na.rm = FALSE)

Arguments

x

Vector containing the values in the set

w

Vector containing the weights to each value (in the same order as x the optimized growth model

na.rm

Should NA values be removed from the set prior to calculation? TRUE/FALSE

Value

The standard deviation of the weighted set of x values

Examples

1
2
3
4
# Create dummy data
x <- seq(1, 10, 0.5)
w <- c(seq(0.1, 1, 0.1), seq(0.9, 0.1, -0.1))
SDw <- sd_wt(x, w, na.rm = TRUE) # Run the function

ShellChron documentation built on July 5, 2021, 5:06 p.m.