pclass: Form nonresponse adjustment classes based on propensity...

pclassR Documentation

Form nonresponse adjustment classes based on propensity scores

Description

Fit a binary regression model for response probabilities and divide units into a specified number of classes.

Usage

pclass(formula, data, link="logit", numcl=5, type, design=NULL)

Arguments

formula

symbolic description of the binary regression model to be fitted as used in glm

data

an optional data frame; must be specified if type="unwtd"

link

a specification for the model link function; allowable values are "logit", "probit", or "cloglog"

numcl

number of classes into which units are split based on estimated propensities

type

whether an unweighted or weighted binary regression should be fit; allowable values are "unwtd" or "wtd"

design

sample design object; required if type="wtd"

Details

A typical formula has the form response ~ terms where response is a two-level variable coded as 0 or 1, or is a factor where the first level denotes nonresponse and the second level is response. If type="unwtd", glm is used to fit an unweighted regression. If type="wtd", svyglm in the survey package is used to fit a survey-weighted regression.

Value

A list with components:

p.class

propensity class for each unit

propensities

estimated response probability for each unit

Author(s)

Richard Valliant, Jill A. Dever, Frauke Kreuter

References

Valliant, R., Dever, J., Kreuter, F. (2018, chap. 13). Practical Tools for Designing and Weighting Survey Samples, 2nd edition. New York: Springer.

See Also

NRadjClass

Examples

    # classes based on unweighted logistic regression
require(PracTools)
data(nhis)
out <- pclass(formula = resp ~ age + as.factor(sex) + as.factor(hisp) + as.factor(race),
           data = nhis, type = "unwtd", link="logit", numcl=5)
table(out$p.class, useNA="always")
summary(out$propensities)
    # classes based on survey-weighted logistic regression
require(survey)
nhis.dsgn <- svydesign(ids = ~psu, strata = ~stratum, data = nhis, nest = TRUE, weights = ~svywt)
out <- pclass(formula = resp ~ age + as.factor(sex) + as.factor(hisp) + as.factor(race),
           type = "wtd", design = nhis.dsgn, link="logit", numcl=5)
table(out$p.class, useNA="always")
summary(out$propensities)

PracTools documentation built on Aug. 17, 2022, 5:06 p.m.