Learn R Programming

extracat (version 1.7-6)

innerval: Interval boundaries

Description

This function computes the boundaries of an interval which is symmetric around the median and includes a given percentage of the data. If that's impossible due to ties the interval is chosen to minimize the squared difference between the desired percentage and the actual percentage of the observations included.

Usage

innerval(x, p = 0.95, data.points = TRUE)

Arguments

x

A data vector.

p

The percentage of observations inside the interval.

data.points

Whether to return the most extreme data points within the interval or the interval boundaries.

Value

A vector with the lower and upper boundaries of the interval.

See Also

quantile

Examples

Run this code
# NOT RUN {
x1 <- rnorm(200)
innerval(x1)
quantile(x1, c(0.025, 0.975))


x2 <- rexp(200)
innerval(x2, data.points = FALSE)
innerval(x2)
quantile(x2, c(0.025, 0.975))

# }

Run the code above in your browser using DataLab