svyPVlevel: Proportion in levels estimation

Description Usage Arguments Details Value Author(s) References See Also Examples

Description

This function categorizes the plausible values into specific user defined levels, to estimate the proportion of population totals within this levels.

Usage

1
svyPVlevel(by, svydat, pvs, CATDEF,levlab=NA,right=TRUE, 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.

CATDEF

A numeric vector which contains the cut points with which the plausible values are categorized. The input follows the same notation as the break argument in the cut function.

levlab

A character vector which contains the levels labels. Default is NA – which means that the labels will be paste0("level", NUMBEROFLEVELS)

right

Corresponds to the right argument in the cut function. If TRUE, which is the default, the intervals built by this function are closed on the right.

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.

Details

All variables, including the subsetting ones defined with by, must be part of the survey design object.

Missing values are deleted listwise.

Note that '.' is not allowed as part of the level string of a by variable. For example c("1.thing","2.thing") is not allowed and will cause a error message.

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 different levels defined by the CATDEF vector.

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 on each level given the categories of the first k-1 groups.

Proportion.SE

Contains the SE of the proportion estimate.

Author(s)

Manuel Reif

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

svyPVbenchmark

Examples

1
2
3
4
5
6
data(svy_example1)

erg_l <- svyPVlevel(by = ~ sex, svydat=svy.exrep, 
pvs=c("plaus1","plaus2","plaus3"), CATDEF=c(0,310,322,400))

erg_l

manuelreif/svyPVpack documentation built on May 21, 2019, 11:26 a.m.