Skip to contents

Print svyplan objects

Usage

# S3 method for class 'svyplan_n'
print(x, ...)

# S3 method for class 'svyplan_cluster'
print(x, ...)

# S3 method for class 'svyplan_prec'
print(x, ...)

# S3 method for class 'svyplan_varcomp'
print(x, ...)

# S3 method for class 'svyplan_power'
print(x, ...)

# S3 method for class 'svyplan_n'
format(x, ...)

# S3 method for class 'svyplan_cluster'
format(x, ...)

# S3 method for class 'svyplan_prec'
format(x, ...)

# S3 method for class 'svyplan_varcomp'
format(x, ...)

# S3 method for class 'svyplan_power'
format(x, ...)

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

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

# S3 method for class 'svyplan_n'
as.integer(x, ...)

# S3 method for class 'svyplan_n'
as.double(x, ...)

# S3 method for class 'svyplan_cluster'
as.integer(x, ...)

# S3 method for class 'svyplan_cluster'
as.double(x, ...)

# S3 method for class 'svyplan_power'
as.integer(x, ...)

# S3 method for class 'svyplan_power'
as.double(x, ...)

# S3 method for class 'svyplan_strata'
print(x, ...)

# S3 method for class 'svyplan_strata'
format(x, ...)

# S3 method for class 'svyplan_strata'
as.data.frame(x, ...)

# S3 method for class 'svyplan_strata'
as.integer(x, ...)

# S3 method for class 'svyplan_strata'
as.double(x, ...)

Arguments

x

A svyplan object.

...

Additional arguments (currently unused).

object

A svyplan object (for confint methods).

parm

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

level

Confidence level (default 0.95).

Value

x (or object), invisibly. confint returns a 2-column matrix with the lower and upper confidence limits.

Details

confint

confint() computes a confidence interval for the estimated parameter (proportion or mean). For proportions, the interval type matches the method used to compute the sample size ("wald", "wilson", or "logodds"). For means, a symmetric z-interval is used (requires mu in the original call).

For svyplan_cluster objects, per-stage sizes are ceiled to integers for operational use. The total shown by print(), format(), and as.integer() is the product of ceiled per-stage sizes, the number of interviews to actually conduct. The unrounded continuous optimum (x$total_n) is shown in parentheses and returned by as.double().

Summary: as.integer(x) = operational total (what goes in the field), as.double(x) = continuous optimum (what the math solved for).

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