weights_med: Estimate weights for natural (in)direct effects estimation

View source: R/A1-weights_med.R

weights_medR Documentation

Estimate weights for natural (in)direct effects estimation

Description

Estimates inverse probability weights that form pseudo treated and control samples and cross-world weights that form (one or two) pseudo cross-world samples.

Usage

weights_med(
  data,
  s.wt.var = NULL,
  cross.world = "10",
  a.c.form,
  a.cm.form,
  max.stabilized.wt = 30,
  plot = TRUE,
  c.order = NULL,
  m.order = NULL,
  c.std = NULL,
  m.std = NULL
)

Arguments

data

A data frame.

s.wt.var

Optional, name of variable containing sampling weights.

cross.world

The cross-world condition involved in the effect decomposition of choice. Should be "10" if want the (NDE0, NIE1) pair, "01" if want the (NIE0, NDE1) pair, or "both" if want both decompositions.

a.c.form

Formula for the P(A|C) model (the propensity score model).

a.cm.form

Formula for the P(A|C,M) model.

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.

c.order

Order in which covariates are to be plotted. If not specify, use the order that appears in a.c.form.

m.order

Order in which mediators are to be plotted. If not specify, use the order that appears in a.cm.form.

c.std

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

m.std

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

Value

A list including

  • w.datA data frame for the pseudo samples with estimated weights.

  • plot.wtsA plot of the distributions of the weights.

  • plot.balanceA plot of the balance in covariates and mediators of the pseudo samples.

See Also

Other weighting schemes: weights_ipw(), weights_odds()


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