sd_wt: Function to calculate weighted standard deviation

View source: R/sd_wt.r

sd_wtR Documentation

Function to calculate weighted standard deviation

Description

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

Usage

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

# 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

nielsjdewinter/ShellChron documentation built on Aug. 21, 2022, 4:31 p.m.