Standard error

Description

Calculates the standard error of the values in x

Usage

1
se(x, na.rm = FALSE)

Arguments

x

a numeric vector.

na.rm

a logical value indicating whether NA values should be stripped before the computation proceeds.

Details

The standard error of a length one vector is NA and if x is not a vector an error will be printed.

The standard error is defined as:

SE = sqrt(var(x)/length(x))

Value

The standard error of x is returned.

Author(s)

Thomas Kvalnes

See Also

var, length, sqrt

Examples

1
2
3
4
5
6
#The standard error of samples with the same mean and standard deviation, but
  #of different sizes.
se(rnorm(n = 10, mean = 5, sd = 1))
se(rnorm(n = 100, mean = 5, sd = 1))
se(rnorm(n = 1000, mean = 5, sd = 1))
se(rnorm(n = 10000, mean = 5, sd = 1))