mmstdev: Using the method of moments to calculate a standard deviation

Description Usage Arguments Details Author(s) See Also Examples

View source: R/mmstdev.R

Description

Uses the method of moments to calculate the sample standard deviation.

Usage

1

Arguments

x

A number or vector of numbers

Details

Why would you want to do this? You wouldn't. You should use 'sd'.

This is just to document how to do it, so that the steps are available within the function definition. The steps are useful if you're trying to calculate stdev within a map reduce framework, apply a rolling standard deviation, or calculate a weighted standard deviation.

This function uses the form ( E[X] ^ 2 - E[X ^ 2] ) * (N / (N - 1))

Author(s)

Gene Leynes

See Also

sd Standard deviation.

Examples

1
2
3
4
5
6
7
		require(geneorama)

		set.seed(10)
	examp <- runif(n = 10, min = 4, max = 13)
		
		sd(examp)
		lines(stirling(1:15), type = "o", col="red")

geneorama/geneorama documentation built on Oct. 17, 2020, 12:35 a.m.