Skip to contents

Compute a confidence interval for the parameter a sizing or precision result was built around, at the planned sample size.

Usage

# S3 method for class 'svyplan_n'
confint(object, parm, level = 0.95, ...)

# S3 method for class 'svyplan_prec'
confint(object, parm, level = 0.95, ...)

Arguments

object

A n_prop(), n_mean(), prec_prop(), or prec_mean() result.

parm

Ignored (included for S3 consistency with confint()).

level

Confidence level (default 0.95). This is independent of the alpha used to size the design, so a plan built at alpha = 0.05 can be reported at any level.

...

Additional arguments are not supported and produce an error.

Value

A one-row, two-column matrix with the lower and upper confidence limits, named for the percentiles they correspond to.

Details

For proportions, the interval type matches the method the result was computed with ("wald", "wilson", "logodds", or "beta"), including its df when the beta method carries one. Only the Wald interval is symmetric about p, so for the other three the limits are not p plus or minus the reported moe; $moe remains half the interval width, and confint() is the way to read where the interval actually sits. All four apply deff, resp_rate, and the finite population correction through the same effective size the sizing functions use.

For means, a symmetric z-interval is used, which requires mu in the original call.

Multi-indicator results (n_multi(), prec_multi()) and allocation results have no single parameter to bound, and error rather than returning an interval for an arbitrary component.

See also

n_prop() and prec_prop() for the methods themselves, print.svyplan for printing and coercion.

Examples

# confint on a proportion sample size
res <- n_prop(p = 0.3, moe = 0.05)
confint(res)
#>  2.5 % 97.5 %
#>   0.25   0.35

# confint at 90% level
confint(res, level = 0.90)
#>      5.0 %    95.0 %
#>  0.2580387 0.3419613

# confint on a mean (requires mu)
res_mean <- n_mean(var = 100, mu = 50, moe = 2)
confint(res_mean)
#>  2.5 % 97.5 %
#>     48     52

# confint on a precision result
prec <- prec_prop(p = 0.3, n = 400)
confint(prec)
#>      2.5 %    97.5 %
#>  0.2550916 0.3449084

# The Korn-Graubard interval is asymmetric for a rare outcome
confint(prec_prop(p = 0.02, n = 150, method = "beta"))
#>        2.5 %     97.5 %
#>  0.004143625 0.05733422