MyNixOS website logo
Description

Marginalization over Incomplete Auxiliaries.

Implements methods to estimate conditional outcome means in settings with missingness-not-at-random and incomplete auxiliary variables. Specifically, this package implements the marginalization over incomplete auxiliaries (MIA) method. The package supports continuous and binary outcomes, and supports auxiliary variables that are normal, binary, and categorical.

miapack

R-CMD-check Codecov testcoverage

The miapack package implements methods to estimate conditional outcome means in settings with missingness-not-at-random and incomplete auxiliary variables. Specifically, this package implements the marginalization over incomplete auxiliaries (MIA) method.

Installation

You can install the development version of miapack from GitHub with:

# install.packages("devtools")
devtools::install_github("stmcg/miapack")

Example

We first load the package.

library(miapack)

Data Set

We will use the example dataset dat.sim included in the package. The dataset contains 9,297 observations with a continuous outcome Y, a binary auxiliary variable W, and binary predictors X1 and X2. The first 10 rows of dat.sim are:

dat.sim[1:10,]
#>           Y X1 X2  W
#> 1        NA  0 NA  0
#> 2        NA  1  1 NA
#> 3  6.066826  1  1  1
#> 4  6.113787  1  1  1
#> 5        NA  1  1 NA
#> 6        NA NA NA  0
#> 7        NA NA NA  0
#> 8        NA  1 NA  0
#> 9  6.439700  1  1 NA
#> 10 6.859992  1 NA  1

MIA Method

The MIA method estimates the conditional outcome mean $\mu_{\text{MIA}}(x)$, which is identified by $$\int_{w} E [ Y | X=x, W=w, M=1 ] p( w | X=x, R_W = R_X = 1 ) dw$$ where $R_W$ and $R_X$ are indicators of non-missing values of $W$ and $X$, respectively, and $M$ is an indicator of a complete case pattern (i.e., $Y$, $X$, and $W$ are non-missing). The MIA method estimates the identifying functional by fitting models for the conditional mean of $Y$ and conditional density of $W$ and performing Monte Carlo integration to compute the integral.

The function mia implements the MIA method to obtain point estimates of the identifying functionals of $\mu_{\text{MIA}}(x_1)$ and $\mu_{\text{MIA}}(x_2)$ as well as contrasts between them (differences, ratios). This function requires specifying the following regression models:

  • Y_model: Formula for the outcome model
  • W_model: Formula for the auxiliary model when the auxiliary variable is univariate, or a list of formulas for each component of the auxiliary variable

It also requires specifying the names of the variable(s) $X$ by X_names and their values $x_1$ and $x_2$ by X_values_1 and X_values_2, respectively.

An application of mia to estimate $\mu_{\text{MIA}}(x_{1,1} = 0, x_{1,2} = 1)$ and $\mu_{\text{MIA}}(x_{2,1} = 0, x_{2,2} = 0)$ as well as their difference is given below. Note that we set a random number seed because the function involves performing Monte Carlo integration.

set.seed(1234)
res <- mia(data = dat.sim,
           X_names = c("X1", "X2"), 
           X_values_1 = c(0, 1), X_values_2 = c(0, 0),
           Y_model = Y ~ W + X1 + X2, W_model = W ~ X1 + X2)
res
#> MIA METHOD FOR CONDITIONAL MEAN ESTIMATION
#> ==========================================
#> 
#> Setting:
#>   Outcome variable type:       continuous
#>   Auxiliary variable(s) type:  binary (W)
#> 
#> Results:
#>   Predictor values:            X1=0, X2=1
#>   Mean estimate:               2.1335
#> 
#>   Predictor values:            X1=0, X2=0
#>   Mean estimate:               -0.1636
#> 
#>   Mean difference estimate:    2.2971

We can obtain 95% confidence intervals around our estimates by applying the get_CI function to the output of the mia function. The get_CI function performs nonparametric bootstrap. Here, we use the percentile method with 100 bootstrap replicates for ease of computation.

get_CI(res, n_boot = 100, type = 'perc')
#> BOOTSTRAP CONFIDENCE INTERVALS FOR MIA METHOD
#> =============================================
#> 
#> Setting:
#>   Confidence level:        0.95
#>   Interval type:           perc
#>   Number of replicates:    100
#> 
#> Results:
#>   Predictor values:        X1=0, X2=1
#>   CI for mean:             (2.0350, 2.2495)
#> 
#>   Predictor values:        X1=0, X2=0
#>   CI for mean:             (-0.2638, -0.0588)
#> 
#>   CI for difference:       (2.1565, 2.4539)
Metadata

Version

0.1.0

License

Unknown

Platforms (78)

    Darwin
    FreeBSD
    Genode
    GHCJS
    Linux
    MMIXware
    NetBSD
    none
    OpenBSD
    Redox
    Solaris
    uefi
    WASI
    Windows
Show all
  • aarch64-darwin
  • aarch64-freebsd
  • aarch64-genode
  • aarch64-linux
  • aarch64-netbsd
  • aarch64-none
  • aarch64-uefi
  • aarch64-windows
  • aarch64_be-none
  • arm-none
  • armv5tel-linux
  • armv6l-linux
  • armv6l-netbsd
  • armv6l-none
  • armv7a-linux
  • armv7a-netbsd
  • armv7l-linux
  • armv7l-netbsd
  • avr-none
  • i686-cygwin
  • 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-linux
  • 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-uefi
  • x86_64-windows