weights_ipw: Estimate inverse probability weights

View source: R/A2-weights_ipw.R

weights_ipwR Documentation

Estimate inverse probability weights

Description

This function estimates weights that form two pseudo treated and pseudo control samples (as if for total effect estimation)

Usage

weights_ipw(
  data,
  s.wt.var = NULL,
  a.form,
  max.stabilized.wt = 30,
  plot = TRUE,
  vars.std = NULL,
  vars.order = NULL
)

Arguments

data

A data frame.

s.wt.var

Optional, name of variable containing sampling weights.

a.form

Formula for model of treatment given the variables that need to be balanced.

max.stabilized.wt

Max stabilized weight allowed. Larger weights are truncated to this level. Default is 30.

plot

Whether to output weight distribution and balance plots. Defaults to TRUE.

vars.std

Variables whose mean differences are to be standardized in balance plot. Ignore if plot==FALSE.

vars.order

Order in which variables are to appear in the balance plot. If not specify, use the order that appears in a.form.

Value

A list including

w.dat A data frame for the pseudo samples with estimated weights.
plot.wts A plot of the distributions of the weights.
plot.balance A plot of the balance in covariates and mediators of the pseudo samples.

See Also

Other weighting schemes: weights_med(), weights_odds()


trangnguyen74/tnMediation documentation built on May 3, 2023, 6:58 a.m.