estimate_wtd: Pure weighting estimator

View source: R/C1-estimate_wtd.R

estimate_wtdR Documentation

Pure weighting estimator

Description

Function that implements the pure weighting estimator of natural (in)direct effects.

Usage

estimate_wtd(
  data,
  s.wt.var = NULL,
  cross.world = "10",
  effect.scale = "MD",
  boot.num = 999,
  boot.seed = NULL,
  boot.method = "cont-wt",
  boot.stratify = TRUE,
  a.c.form,
  a.cm.form,
  y.var,
  max.stabilized.wt = 30,
  plot = TRUE,
  c.std = NULL,
  m.std = NULL,
  c.order = NULL,
  m.order = 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.

effect.scale

The scale of effect of choice. Defaults to "MD" (i.e., mean/risk difference or additive). If outcome is non-negative, also allows "mean ratio" (which could also be specified as "ratio", "MR", "risk ratio", "rate ratio", "RR"). If outcome is binary or bounded within the (0,1) interval, also allows "odds ratio" (which could also be specified as "OR").

boot.num

Number of bootstrap samples used for interval estimation, defaults to 999. If just want point estimate, set to 0.

boot.seed

Optional, specify bootstrap seed for reproducibility.

boot.method

Method for drawing bootstrap samples. Options: "cont-wt" for continuous weights bootstrap, and "resample" for bootstrap by simple resampling (i.e., integer weights bootstrap).

boot.stratify

Whether bootstrap samples are drawn stratified by treatment variable. Defaults to TRUE.

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.

y.var

Name of the outcome variable.

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.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.

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.

Value

If plot==FALSE and boot.num==0, a point estimate vector including the potential outcome means and the effects.

Otherwise, a list of objects including:

estimates point estimates (and if boot.num>0) 95% quantile intervals and standard errors
boot.seed the seed used for the bootstrap (if boot.num>0)
wt.dist.plot a ggplot2 plot of weight distributions (if plot==TRUE)
balance.plot a ggplot2 plot of balance on the means of covariate and mediator for the pseudo samples (if plot==TRUE)

See Also

Other estimators: estimate_NDEpredR(), estimate_NDEpred(), estimate_Y2predR(), estimate_Y2pred(), estimate_YpredMR(), estimate_Ypred(), estimate_psYpredMR(), estimate_psYpred(), estimate_wpCadj(), estimate_wpMRCadj(), estimate_wtCadj()


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