sem: Standard Error of the Mean

View source: R/S05_Statistics.R

semR Documentation

Standard Error of the Mean

Description

This function calculates the standard error of the mean for a set of numeric values.

Usage

sem(x, na.rm = TRUE)

Arguments

x

A numeric vector.

na.rm

Logical; if TRUE, removes NA values first.

Details

Given the standard deviation s_x and sample size n of a sample x, the standard error of the mean is:

\frac{s_x}{\sqrt{n}}.

Value

The standard error of the mean.

Examples

# Simulate 100 values from a normal distribution
set.seed(2)
x <- rnorm(100)
# Standard error of the mean should be ~0.1
sem(x)

rettopnivek/arfpam documentation built on Oct. 20, 2024, 7:24 p.m.