Learn R Programming

svyPVpack (version 0.1-1)

svyPVquantile: Quantile estimation

Description

This function estimates quantiles of plausible values within groups.

Usage

svyPVquantile(by, svydat, pvs, quantile, interval.type = "quantile", colN=FALSE, ...)

Arguments

by
A formula statement is expected which splits the data into several subsets. Within these subsets the quantiles are estimated.
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.
quantile
A numeric vector of length > 1 which contains the quantiles of interest.
interval.type
A character vector of length = 1 which denotes the kind of quantile estimation method. Valid inputs are: "quantile" and "probability" if a svrepdesign was submitted and in case of a oridinary survey design the valid inputs are: "Wald", "score" and "betaWald". More information about the different estimation techniques can be gained from the "Details" section of the svyquantile function in the survey package.
...
More arguments which are forwarded to svyquantile.
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.
q0...
These columns contain the quantile values which were estimated by means of the submitted plausible values.

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

svyPVpm

Examples

Run this code
data(svy_example1)

erg_q <- svyPVquantile(by = ~ sex, svydat=svy.exrep,
pvs=c("plaus1","plaus2","plaus3"), quantile=c(0.2,0.7))

erg_q

Run the code above in your browser using DataLab