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 sizing or precision result from n_prop()/prec_prop(), n_mean()/prec_mean(), n_ratio()/prec_ratio(), n_change()/prec_change(), or n_pooled()/prec_pooled().

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"). All four methods read a stored df. Beta applies it through effective-size scaling, while the other three substitute the corresponding t quantile. 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, ratios, changes and pooled estimates the interval is symmetric about the estimand, at the normal quantile or, when the result carries a df, the t quantile it was built with. A mean requires mu in the original call, since a size targeted on moe alone knows the spread but not the level. A ratio always has r, so it needs nothing extra.

A ratio interval is the first-order symmetric one, r plus or minus q * se. It is not a Fieller interval and does not correct the ratio estimator's bias.

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

# confint on a ratio, which always carries its center r
confint(n_ratio(r = 2, cv_num = 0.5, cv_den = 0.3,
                component_cor = 0.4, cv = 0.05))
#>     2.5 %   97.5 %
#>  1.804004 2.195996

# confint on a repeated-survey result, the pooled level here
confint(prec_pooled(var = 100, n = 300, occasions = 2, mu = 50))
#>     2.5 %   97.5 %
#>  49.19985 50.80015