svyPVpm: Mean and proportion estimation

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

View source: R/svyPVpm.R

Description

This function estimates mean, standard deviation and proportion of subsets based on a survey design and plausible values.

Usage

1
svyPVpm(by, svydat, pvs, colN=FALSE)

Arguments

by

A formula statement is expected which splits the data into several subsets. Means and proportions will be estimated within these subsets.

svydat

A survey design which was generated by 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.

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 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.

pvs_mean

Shows the mean estimate of plausible values within each group.

pvs_mean.SE

Denotes the Standard error of the mean estimate.

pvs_stddev

Shows the standard deviation (sd) estimate of plausible values within each group.

pvs_stddev.SE

Denotes the Standard error of the sd 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

svyPVglm svyPVprob

Examples

1
2
3
4
5
data(svy_example1)

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

erg_pm

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