View source: R/S05_Statistics.R
bounds | R Documentation |
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.).
bounds(width)
width |
The width of the interval, a numeric value between 0 and 1. |
A vector with the lower and upper limits.
# 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 ) )
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.