ct_ci: Calculate confidence interval

View source: R/utils.R

ct_ciR Documentation

Calculate confidence interval

Description

Calculates the confidence interval for the mean of a numeric vector using the t-distribution.

Usage

ct_ci(x, alpha = 0.05, side = "all")

Arguments

x

A numeric vector of data values.

alpha

Significance level for the confidence interval. Default is 0.05 (for 95% confidence).

side

A character string indicating the type of interval:

"all"

Two-sided confidence interval (default).

"left"

One-sided lower bound.

"right"

One-sided upper bound.

Value

A numeric vector containing the confidence interval bounds:

  • If side = "all", returns a vector of length 2: c(lower, upper).

  • If side = "left" or "right", returns a single numeric value.

Examples

x <- c(10, 12, 11, 14, 13, 15)
ct_ci(x)
ct_ci(x, alpha = 0.01)
ct_ci(x, side = "left")


ct documentation built on Oct. 22, 2026, 1:07 a.m.