se: Calculate standard error

View source: R/se.R

seR Documentation

Calculate standard error

Description

If x is a numeric vector with more than two unique values, this returns the standard error of the mean using the following formula:

Usage

se(x, proportion = length(unique(x)) == 2, na.rm = TRUE)

Arguments

x

a numeric vector to calculate the standard error for.

proportion

whether to use the standard error for a proportion.

na.rm

a logical evaluating to TRUE or FALSE indicating whether NA values should be stripped before the computation proceeds.

Details

se = \frac{s}{\sqrt{n}}

where s is the sample standard deviation and n is the sample size.

If proportion = TRUE (which is the default when there are only two unique values in x) this returns the standard error for a proportion using the following formula:

se = \frac{p\(1 - p)}{n}

where p is the proportion of success and n is the sample size.

Value

the standard error.


jbryer/VisualStats documentation built on Feb. 27, 2025, 6:19 p.m.