Learn R Programming

capm (version 0.11.0)

SummarySurvey: Summary statistics for sample surveys

Description

Wraps functions for summary statistics from survey package.

Usage

SummarySurvey(design = NULL, variables = NULL, conf.level = 0.95,
  rnd = 3)

Arguments

design

an output form DesignSurvey function.

variables

character vector with the type of estimate for each variable contained in design (see details).

conf.level

the confidence level required.

rnd

the number of decimal places (round) or significant digits (signif) to be used. If NA, scientific notation is used.

Value

Matrix with survey summaries.

Details

The length of variables must be equal to the length of names(design$variables) (see examples).

References

Lumley, T. (2011). Complex surveys: A guide to analysis using R (Vol. 565). Wiley.

http://oswaldosantos.github.io/capm

Examples

Run this code
# NOT RUN {
data(city)
data(hh)
## Two-stage cluster design that included 65 PSU.
data(cluster_sample)
cluster_sample2 <- cluster_sample[complete.cases(cluster_sample), c(1:2, 8:10)]
design <- DesignSurvey(sample = cluster_sample2,
             psu.ssu = city[, c("track_id", "hh")],
             psu.col = "track_id", ssu.col = "hh_id", psu.2cd = 65,
             cal.col = "persons", cal.N = sum(hh$persons))
vars <- rep("total", 3)
cbind(names(design$variables), vars)
SummarySurvey(design = design, variables = vars)

## Systematic sampling
data(sys_sample)
sys_sample2 <- sys_sample[complete.cases(sys_sample), 7:9]
design <- DesignSurvey(sample = sys_sample2, N = sum(city$hh),
                       cal.col = "persons", cal.N = sum(hh$persons))
vars <- rep("total", 3)
cbind(names(design$variables), vars)
#SummarySurvey(design = design, variables = vars)

# }

Run the code above in your browser using DataLab