Learn R Programming

fb4package (version 2.0.0)

calculate_confidence_intervals: Confidence interval from estimate and standard error

Description

Computes a symmetric confidence interval given a point estimate and its standard error. Returns NA bounds when either input is NA.

Usage

calculate_confidence_intervals(
  estimate,
  se,
  confidence_level = 0.95,
  method = "normal"
)

Value

Named list with ci_lower, ci_upper,

method, and confidence_level

Arguments

estimate

Numeric point estimate (scalar or vector)

se

Standard error of the estimate

confidence_level

Confidence level in (0, 1), default 0.95

method

"normal" (default) for symmetric normal-theory interval; "log-normal" for a delta-method interval on the log scale (requires estimate > 0)

Examples

Run this code
calculate_confidence_intervals(0.5, 0.05)
calculate_confidence_intervals(0.5, 0.05, confidence_level = 0.99)
calculate_confidence_intervals(NA, 0.05)

Run the code above in your browser using DataLab