MyNixOS website logo
Description

Navigated Weighting for the Inverse Probability Weighting.

Implements the navigated weighting (NAWT) proposed by Katsumata (2020) <arXiv:2005.10998>, which improves the inverse probability weighting by utilizing estimating equations suitable for a specific pre-specified parameter of interest (e.g., the average treatment effects or the average treatment effects on the treated) in propensity score estimation. It includes the covariate balancing propensity score proposed by Imai and Ratkovic (2014) <doi:10.1111/rssb.12027>, which uses covariate balancing conditions in propensity score estimation. The point estimate of the parameter of interest as well as coefficients for propensity score estimation and their uncertainty are produced using the M-estimation. The same functions can be used to estimate average outcomes in missing outcome cases.

nawtilus: An R Package for the Navigated Weighting (NAWT)

nawtilus provides a procedure for the navigated weighting (NAWT) proposed by Katsumata (2020), which estimates a pre-specified parameter of interest (e.g., the average treatment effects or the average treatment effects on the treated) with the inverse probability weighting where propensity scores are estimated using estimating equations suitable for the parameter of interest. It also provides several tools for summarizing and checking the estimation results, including a covariate balance check and an inverse probability weights plot.


CRANstatus metacrandownloads

How to cite

<font size="4"> Katsumata, Hiroto. 2020. “Navigated Weighting to Improve Inverse Probability Weighting for Missing Data Problems and Causal Inference.” Working Paper, arxiv:2005.10998.

Katsumata, Hiroto. 2020. nawtilus: Navigated Weighting for the Inverse Probability Weighting. R package version 0.1.4. </font

Installation

You can install the released version of nawtilus from CRAN with:

install.packages("nawtilus")

And the development version from GitHub with:

# install.packages("devtools")
devtools::install_github("hirotokatsumata/nawtilus")

Example

This example shows how to use nawtilus for estimation of parameter of interest.

First, load the package and make toy data.

# Load the package
library(nawtilus)

# Make toy data
# ATT estimation
# True ATT is 10
tau <- 10
set.seed(12345)
n <- 1000
X <- matrix(rnorm(n * 4, mean = 0, sd = 1), nrow = n, ncol = 4)
prop <- 1 / (1 + exp(X[, 1] - 0.5 * X[, 2] + 0.25 * X[, 3] + 0.1 * X[, 4]))
treat <- rbinom(n, 1, prop)
y <- 210 + 27.4 * X[, 1] + 13.7 * X[, 2] + 13.7 * X[, 3] + 13.7 * X[, 4] + 
     tau * treat + rnorm(n)

# Data frame
df <- data.frame(X, treat, y)
colnames(df) <- c("x1", "x2", "x3", "x4", "treat", "y")

Then, specify a model for propensity score estimation.

formula_c <- as.formula(treat ~ x1 + x2 + x3 + x4)

Fit the model for the average treatment effects on the treated (ATT) estimation using nawt() with the default setting (a power weighting function with α = 2).

# Power weighting function with alpha = 2
fit <- nawt(formula = formula_c, outcome = "y", estimand = "ATT", 
            method = "score", data = df, alpha = 2)
#> [1] "Estimate weights for the ATT estimation by (weighted) score conditions"

You can summarize the results easily with summary().

summary(fit)
#> 
#> Call: 
#> nawt(formula = formula_c, outcome = "y", estimand = "ATT", method = "score", 
#>     data = df, alpha = 2)
#> 
#> ATT estimates:  10.54
#> 
#> Coefficients:
#>             Estimate Std..Error z.value  Pr...z..    
#> est         10.54356    1.19535  8.8205 0.000e+00 ***
#> (Intercept)  0.01142    0.07642  0.1494 8.812e-01    
#> x1          -1.05398    0.12718 -8.2871 2.220e-16 ***
#> x2           0.43165    0.09211  4.6860 2.786e-06 ***
#> x3          -0.21745    0.08829 -2.4629 1.378e-02   *
#> x4           0.12933    0.09039  1.4308 1.525e-01    
#> ---
#> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 
#> 
#> Effective N for the propensity score estimation: 610.16
#> Effective N for the ATT estimation:
#>   treatment: 475 
#>   control:   156.68

Note that the estimated coefficients except for est are for the propensity score estimation.

Check covariate balance between the treatment and control groups before and after the NAWT with cbcheck().

oldpar <- par(no.readonly = TRUE) # Just for adjusting plot margins
par(mar = c(5.1, 5.1, 4.1, 2.1)) # Just for adjusting plot margins
cbcheck(fit)
par <- oldpar # Just for adjusting plot margins

Let’s compare the inverse probability weights estimated by the nawt with those estimated by the standard logistic regression with plot().

plot(fit)

Finally, check the weights used in propensity score estimation and distribution of the estimated propensity scores in the NAWT with plot_omega().

plot_omega(fit)
Metadata

Version

0.1.4

License

Unknown

Platforms (75)

    Darwin
    FreeBSD
    Genode
    GHCJS
    Linux
    MMIXware
    NetBSD
    none
    OpenBSD
    Redox
    Solaris
    WASI
    Windows
Show all
  • aarch64-darwin
  • aarch64-genode
  • aarch64-linux
  • aarch64-netbsd
  • aarch64-none
  • aarch64_be-none
  • arm-none
  • armv5tel-linux
  • armv6l-linux
  • armv6l-netbsd
  • armv6l-none
  • armv7a-darwin
  • armv7a-linux
  • armv7a-netbsd
  • armv7l-linux
  • armv7l-netbsd
  • avr-none
  • i686-cygwin
  • i686-darwin
  • i686-freebsd
  • i686-genode
  • i686-linux
  • i686-netbsd
  • i686-none
  • i686-openbsd
  • i686-windows
  • javascript-ghcjs
  • loongarch64-linux
  • m68k-linux
  • m68k-netbsd
  • m68k-none
  • microblaze-linux
  • microblaze-none
  • microblazeel-linux
  • microblazeel-none
  • mips-linux
  • mips-none
  • mips64-linux
  • mips64-none
  • mips64el-linux
  • mipsel-linux
  • mipsel-netbsd
  • mmix-mmixware
  • msp430-none
  • or1k-none
  • powerpc-netbsd
  • powerpc-none
  • powerpc64-linux
  • powerpc64le-linux
  • powerpcle-none
  • riscv32-linux
  • riscv32-netbsd
  • riscv32-none
  • riscv64-linux
  • riscv64-netbsd
  • riscv64-none
  • rx-none
  • s390-linux
  • s390-none
  • s390x-linux
  • s390x-none
  • vc4-none
  • wasm32-wasi
  • wasm64-wasi
  • x86_64-cygwin
  • x86_64-darwin
  • x86_64-freebsd
  • x86_64-genode
  • x86_64-linux
  • x86_64-netbsd
  • x86_64-none
  • x86_64-openbsd
  • x86_64-redox
  • x86_64-solaris
  • x86_64-windows