sem: Standard error of the mean (SEM)

View source: R/sem.r

semR Documentation

Standard error of the mean (SEM)

Description

Compute the standard error of the mean (SEM). The SEM is the standard deviation of the sample-mean's estimate of a population mean. It therefore describes the accuracy of the calculation of a sample's mean. If na.rm is TRUE then missing values are removed before computation proceeds.

Usage

sem(x, na.rm = FALSE)

Arguments

x

a numeric vector

na.rm

logical. Should missing values be removed?

Value

A numeric scalar – the standard error of the mean.

Details

The SEM of a zero-length vector (after removal of NAs if na.rm = TRUE) is not defined and gives an error. The SEM of a length-one vector is NA.

See Also

sd

Examples

## Calculate mean and SEM for variable soil depth
mean(schedenenv$soil_depth)
sem(schedenenv$soil_depth)

fgoral/goeveg documentation built on Feb. 27, 2024, 6:32 a.m.