help for ipwbreg(Roger Newson)

Inverse propensity weights from Bernoulli regression

ipwbreg depvar
[indepvars]
[weight]
[if] [in]
[,
nostabfact ltrim(#) rtrim(#)

probability(newvar)
xb(newvar)
ipweight(newvar)

atetweight(newvar)
atecweight(newvar)
ovweight(newvar)

glm_options
]

where glm_options are options for glm,
other than the asis and family() options.

fweights, iweights, and pweights are allowed; see
weight.
They are interpreted as weights of the same kinds with glm.

Description

ipwbreg fits a Bernoulli generalized linear regression model for a binary dependent variable
in a list of independent variables,
and then outputs a list of inverse propensity weight variables.
These propensity weight variables may be used to estimate propensity-adjusted effects
of the binary treatment on an outcome variable.
ipwbreg requires the xlink package,
if it is used with the extra link functions for glm
supplied in xlink.

Options

nostabfact specifies that the stabilization factors a_0 and a_1 are set to 1.
If nostabfact is not specified,
then a_0 is set to the proportion of observations in the estimation sample
in which the dependent binary variable depvar is 0,
and a_1 is set to the proportion of observations in the estimation sample
in which the dependent variable is 1.
These proportions are weighted by the [weight] expression,
if weights are present.
For an explanation of the role of stabilization factors in weighting methods,
see
Methods and formulas below.

ltrim(#) specifies a minimum predicted probability,
such that predicted probabilities below it will be reassinged (or left-trimmed) to it.
It must be between 0 and 1 (inclusive).

rtrim(#) specifies a maximum predicted probability,
such that predicted probabilities above it will be reassinged (or right-trimmed) to it.
It must be between 0 and 1 (inclusive).

probability(newvar), xb(newvar), ipweight(newvar),
atetweight(newvar), atecweight(newvar), and ovweight(newvar)
specify the names of optional generated output variables,
containing, respectively, the predicted probabilities, the predicted link funcions,
the inverse-propensity weights for estimating the average treatment effect,
the inverse-propensity weights for estimating the average treatment effects in the treated,
the inverse-propensity weights for estimating the average treatment effects in the controls (untreated),
and the propensity overlap weights,
respectively.
Inverse probability weights can be used as inverse treatment probability weights
for estimation of the average treatment effects for the whole sample, the treated, or the untreated,
if the outcome is a treatment indicator,
or as inverse completeness probability weights for the subsample with outcome 1,
if the outcome is a completeness indicator.

Methods and formulas

The Bernoulli regression model is fitted using a glm command of the form

glm depvar [indepvars] [if] [in] [weight] , family(bernoulli) asis glm_options

where glm_options are options for glm,
other than the asis and family() options.
The default link function is link(logit).

We define a_0 and a_1 as stabilization factors for the binary values 0 and 1,
respectively.
These are both equal to 1 if the option nostabfact is specified,
and otherwise are equal to the weighted proportions of observations, in the estimation sample,
vith outcomes 0 and 1, respectively.
We might view the outcome variable as a treatment indicator.
The inverse propensity weights are designed to standardise the estimation sample directly
to a fantasy population,
with a proportion of positive outcomes (or treated individuals)
equal to 0.5 if nostabfact is specified,
or as in the estimation sample otherwise,
and in which the treatment propensity output by the probability() option
is uncorrelated with the treatment received.
We denote the Bernoulli outcome variable as y.

The inverse propensity weight variable generated by the ipweight() option is equal to

y*a_1/probability + (1-y)*a_0/(1-probability)

The inverse propensity weight variable generated by the atetweight() option is equal to

y*a_1 + (1-y)*a_0*probability/(1-probability)

and is used to estimate the average treatment effect in the treated (ATET).

The inverse propensity weight variable generated by the atecweight() option is equal to

y*a_1*(1-probability)/probability + (1-y)*a_0

and is used to estimate the average treatment effect in the controls (ATEC).

The inverse propensity weight variable generated by the ovweight() option is equal to

y*(1-probability) + (1-y)*probability

and is known as the overlap weight.
Overlap weights are recommended in
Zeng et al. (2021).

A long list of link() options is available,
corresponding to the many link functions compatible with a Bernoulli regression.
The default is link(logit), which is the canonical link for the Bernoulli variance function.
Other examples are link(log) and link(probit).
Alternative link functions are available if the user has installed the SSC package xlink.
One example is link(robit7),
implying a robit link with 7 degrees of freedom,
which is similar to a logit link,
but which is thought by some to be less prone to producing extremely high weights.
The robit link is recommended in
Liu (2004).

Examples

These examples use the lbw dataset,
downloadable using the command webuse.
We create propensity scores for smoking,
indicated by the variable smoke,
based on a list of variables that might predict smoking in a pregnant mother.

Set-up

. webuse lbw, clear

. describe, full

. label list smoke

. tab smoke, m

Compute propensity scores and inverse probability weights from the primary and secondary logit models:

. ipwbreg smoke age lwt ib1.race ptl ib0.ht, prob(myprob) ipw(myipw) atet(myatet) atec(myatec) ovweight(myovw) eform

. describe, full

. summ myprob, de

. summ myipw, de

. summ myatet, de

. summ myatec, de

. summ myovw, de

Use the SSC package somersd, without weights,
to measure power of smoking propensity to predict smoking in our sample:

. somersd smoke myprob, transf(z) tdist

Use the SSC packages somersd and haif to do the balance checks and variance inflation checks, respectively,
for the primary propensity score and the various inverse propensity weights:

. somersd smoke myprob [pwei=myipw], transf(z) tdist

. haif ib0.smoke, pweight(myipw)

. somersd smoke myprob [pwei=myatet], transf(z) tdist

. haif ib0.smoke, pweight(myatet)

. somersd smoke myprob [pwei=myatec], transf(z) tdist

. haif ib0.smoke, pweight(myatec)

. somersd smoke myprob [pwei=myovw], transf(z) tdist

. haif ib0.smoke, pweight(myovw)

Estimate the maternal smoking effect on birth weight using inverse propensity weights:

. regress bwt smoke [pwei=myipw]

This effect is adjusted for the covariates in the propensity model.
It compares mean birthweight if all mothers smoked
with mean birthweight if no mothers smoked.

The packages somersd and haif are downloadable from SSC.
Their use in evaluating the costs and benefits of propensity weights is described in
Newson (2017).

Saved results

ipwbreg saves in e() the estimation results from the glm command
used to fit the binary regression model,
plus the following:

Scalars

e(stabfac0) stabilization factor a_0

e(stabfac1) stabilization factor a_1

Author

Roger Newson, King's College London, UK.

Email: roger.newson@kcl.ac.uk

References

Liu, C. H. 2004.
Robit Regression: A Simple Robust Alternative to Logistic and Probit Regression.
Chapter 21 of:
Gelman, A. and Meng, Xiao-Li. 2004.
Applied Bayesian Modeling and Causal Inference from Incomplete-Data Perspectives: An Essential Journey with Donald Rubin's Statistical Family.
Chichester, UK: John Wiley & Sons Ltd.
Download from the Wiley Online website.

Newson, R. B. 2017. Ridit splines with applications to propensity weighting.
Presented at the 23rd UK Stata Users' Group Meeting, 7-8 September, 2017.

Zeng, S. X., Li, F., Wang, R. and Li, F.
Propensity score weighting for covariate adjustment in randomized clinical trials.
Statistics in Medicine 021; 40: 842-858.

Also see

Manual: [R] glm

On-line: help for glm

help for somersd, haif if installed