Learn R Programming

statpsych (version 2.0.0)

ci.mean.gen: Confidence intervals for generalized means

Description

Computes confidence intervals for three population generalized means (square-root, geometric, and harmonic) using a vector of response scores as input. The square-root mean requires non-negative scores. The geometric and harmonic means require positive scores. The standard errors are recovered from the confidence intervals.

Usage

ci.mean.gen(alpha, y)

Value

Returns a 1-row matrix. The columns are:

  • Estimate - estimated mean

  • SE - recovered standard error

  • LL - lower limit of the confidence interval

  • UL - upper limit of the confidence interval

Arguments

alpha

alpha level for 1-alpha confidence

y

vector of scores

Examples

Run this code
y <- c(32, 47, 28, 15, 20, 41, 87)
ci.mean.gen(.05, y)

# Should return:
#             Estimate       SE       LL       UL
# Square-root 35.79395 8.141122 18.64498 58.48619
# Geometric   33.26410 7.633328 19.47124 56.82741
# Harmonic    29.07073 7.978149 19.35236 58.39602
 

Run the code above in your browser using DataLab