Learn R Programming

SciencesPo (version 1.3.9)

se: Calculates the Standard Error of the Mean

Description

Computes the standard error of the sample mean.

Usage

se(x, na.rm = TRUE, ...)

## S3 method for class 'default': se(x, na.rm = TRUE, ...)

## S3 method for class 'data.frame': se(x, na.rm = TRUE, ...)

Arguments

x
An Robject.
na.rm
A logical value indicating whether NA should be stripped before the computation proceeds. Default is na.rm=TRUE.
...
Additional arguements (currently ignored)

encoding

UTF-8

Details

The standard error of the mean (SEM) (assuming statistical independence of the values in the sample) is estimated by taking the standard deviation of the population sample, divided by the square root of the sample size: $$se = \frac{{s}}{{\sqrt{n}}}$$

Examples

Run this code
x <- c(1, 2.3, 2, 3, 4, 8, 12, 43, -1,-4)
myse <- sd(x)/sqrt(length(x))
myse
# With the 'se' function:
se(x)

Run the code above in your browser using DataLab