Learn R Programming

svyPVpack (version 0.1-1)

svyPVprob: Proportion estimation

Description

This function was created to estimate the proportions of weighted observations within each group.

Usage

svyPVprob(by, svydat, pvs = NULL, colN=FALSE)

Arguments

by
A formula statement is expected which splits the data into several subsets.
svydat
A survey design (svydesign as well as svrepdesign) which was generated by the survey package.
pvs
Either a character vector which contains variablenames (these variables must exist within the survey) or a vector of length 1 which contains NULL. If plausible values (or any other variablenames) are provided by the argument pvs the weighted ratio of group members is computed after listwise deletion of those who contain any NA.

colN
If TRUE the colnames will equal the grouping variable names from the by statement. If FALSE, which is the default, the names will be Group1 up to Group k.

Value

The function returns a data.frame with the following columns
Group1..k
The first k columns show the different levels of the k subsetting groups.
Number.of.cases
Shows the unweighted number of cases (NA's excluded) within each group.
Sum.of.weights
Shows the sum of weights (NA's excluded) within each group.
Proportion
Shows the (weighted) estimated proportion of persons within the categories.
Proportion.SE
Shows the Standard Errors of the proportion estimate.

References

Lumley, T. (2010). Complex Surveys. Hoboken, NJ: Wiley.

Saerndal, C.-E. & Swensson, B. & Wretman, J. (1992). Model Assisted Survey Sampling. New York: Springer.

Chaudhuri, A. & Stenger, H. (2005). Survey Sampling. Theory and Methods. Boka Raton, FL: Chapman & Hall/CRC.

See Also

svyPVprob

Examples

Run this code

data(svy_example1)

erg_p <- svyPVprob(by = ~ sex, svydat=svy.exrep, pvs=c("plaus1","plaus2","plaus3"))

erg_p

Run the code above in your browser using DataLab