SDofSD: Standard deviation (error) of a standard deviation

Description Usage Arguments Details Value Author(s) Examples

View source: R/statistical-functions.R

Description

Calculate the standard deviation (i.e. standard error) of a standard deviation, given n, the number of samples from which the standard deviation was estimated.

Usage

1
SDofSD(s, n)

Arguments

s

standard deviation

n

number of samples from which s was estimated

Details

if n <= 0 an exact method is used, otherwise Stirling's approximation is used to avoid numerical errors calculating the gamma function for large values of n. Formulae taken from https://stats.stackexchange.com/q/28567

Value

numeric

Author(s)

Andrew Dolman <andrew.dolman@awi.de>

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
## Not run: 
if(interactive()){
 SDofSD(1, 12)
 library(ggplot2)
df <- expand.grid(SD = 1:10, n = seq(2, 10, length.out = 100))
df$SDofSD = SDofSD(df$SD, df$n)
ggplot(df, aes(x = n, y = SDofSD, group = SD, colour = SD)) +
  geom_line()
 }

## End(Not run)

EarthSystemDiagnostics/ecustools documentation built on Jan. 15, 2022, 5:22 p.m.