bounds: Lower and Upper Limits for Confidence or Credible Intervals

View source: R/S05_Statistics.R

boundsR Documentation

Lower and Upper Limits for Confidence or Credible Intervals

Description

Given a desired width, computes the lower and upper limit for a confidence or credible interval. Can be combined with functions like quantile or the quantile functions for assorted probability distributions( e.g., qnorm, qbeta, etc.).

Usage

bounds(width)

Arguments

width

The width of the interval, a numeric value between 0 and 1.

Value

A vector with the lower and upper limits.

Examples

# Lower and upper limits of 95% interval
bounds( .95 )
# Example data
x <- rnorm( 100, mean = 100, sd = 15 )
# 95% confidence interval around mean
mean(x) + qnorm( bounds( .95 ) ) * sem( x )
# Predicted
qnorm( bounds( .95 ), mean = 100, sd = 15/sqrt(100) )
# The 1st and 3rd quartiles
quantile( x, bounds( .5 ) )


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