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, seed=NULL, rng.preds=0.05)

Arguments

formula

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

data

an optional data frame containing columns for a response variable and covariates used in the model to predict response propensities; 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"

seed

random number seed

rng.preds

cutoff value for the range of the predicted response probabilities

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. The jitter function is used to perturb regression predictions slightly. To reproduce the same set of weights in different runs, set seed to some non-null integer. Recommended seeds can be found in positions 3:626 of the built-in global vector .Random.seed.

If the range (defined as max - min) of the predicted response probabilities is less than rng.preds, the predictions are considered to have no meaningful variation and a single response adjustment class is returned. rng.preds is adjustable to accomodate different user preferences.

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, seed = 1387014860, 
           rng.preds = 0.05)
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)
    # degenerate case where all response propensities are the same
df <- data.frame(resp = rbinom(500, 1, 0.75), x = rnorm(500))
out1 <- pclass(resp ~ 1, data = df, type = "unwtd", numcl = 5, rng.preds = 0.05)    

PracTools documentation built on Sept. 17, 2026, 1:09 a.m.