Learn R Programming

svyPVpack (version 0.1-1)

svyPVbenchmark: Estimate the proportion below and above a bechmark

Description

This function works in a similar fashion like the svyPVlevel function. It discretizes the plausible values to a dichotomous variable and estimates the proportion of population totals above and below the benchmark within the comitted groups (by statement).

Usage

svyPVbenchmark(by, svydat, pvs, BENCH=NA, 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. To figure out how to create a survey design object, please read the help files for the survey package.
pvs
A character vector which includes the colnames of the plausible values. These variables must be part of the survey design comitted as svydat.
BENCH
Submit a benchmark (numeric vector of length = 1). A plausible value will be assigned to "< benchmark" if it is below the benchmark and assigned to ">= benchmark" if it is on or above the benchmark.
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-1 columns show the different levels of the k-1 subsetting groups, provided with by. The kth group column contains the benchmark variable.
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
Contains the estimate of the conditional proportion of persons below and on/above the benchmark given the categories of the first k-1 groups.
Proportion.SE
Contains the SE 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

svyPVlevel

Examples

Run this code

data(svy_example1)

erg_ben <- svyPVbenchmark(by = ~ sex, svydat=svy.exrep, 
pvs=c("plaus1","plaus2","plaus3"), BENCH=320)

erg_ben



Run the code above in your browser using DataLab