8000 GitHub - alexluedtke12/HilbertOneStep: Implements the one-step estimators of Hilbert-valued parameters that were evaluated in the simulation study in Luedtke and Chung (2023)
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Implements the one-step estimators of Hilbert-valued parameters that were evaluated in the simulation study in Luedtke and Chung (2023)

License

Notifications You must be signed in to change notification settings

alexluedtke12/HilbertOneStep

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Description

The HilbertOneStep package implements one-step estimators of Hilbert-valued parameters, as evaluated in the simulation study from:

"One-Step Estimation of Differentiable Hilbert-Valued Parameters" by A. Luedtke and I. Chung [link]

Installation

To install the package using devtools, run the following commands:

library(devtools)
devtools::install_github("alexluedtke12/HilbertOneStep")

Examples

This package includes four key functions. The first two estimate the counterfactual density under treatment A=1, assuming there are no unmeasured confounders and the positivity assumption holds. The first function implements a regularized one-step estimator that is consistent within a nonparametric model under conditions. See Luedtke and Chung (2023) for rate of convergence guarantees for this estimator.

# load the package
library(HilbertOneStep)

# sample size
n = 500

# simulate data
dat = sim_data(n,setting='zeroBothSides')
W = dat$W
A = dat$A
Y = dat$Y

cv_out = cv_density(W,A,Y,ngrid=500,num_fold_final=2)
cv_out$which_best
ygrid = seq(0.0025,0.9975,by=0.0025)
plot(ygrid,cv_out$best_fun(ygrid),xlab='y',ylab='Counterfactual Density Estimate',type='l')

If it is known that the counterfactual density is bandlimited, a non-regularized one-step estimator of the counterfactual density is available. This estimator achieves a parametric rate of convergence, with mean integrated squared error converging to zero at a rate of 1/n.

# sample size
n = 500

# simulate data
dat = sim_data_bandlimited(n)
W = dat$W
A = dat$A
Y = dat$Y

bl_out = bandlimited_density(W,A,Y,ngrid=500,num_fold=2,num_boot=2000,alpha=seq(0.01,0.99,by=0.01),b=2)
ygrid = seq(-15,15,by=0.01)
plot(ygrid,bl_out$onestep_fun(ygrid),xlab='y',ylab='Counterfactual Density Estimate',type='l')

The package also implements tests to determine whether the counterfactual distributions of the outcome under interventions that set A=1 and A=0 are the same.

# sample size
n = 250

# simulate data from alternative
dat = sim_data(n,setting='nonzeroBothSides',cos_parameter=1)
W = dat$W
A = dat$A
Y = dat$Y

# a test based on a weighted and standardized L2 statistic that contrasts the counterfactual density functions under A=1 and A=0
density_test(W,A,Y,num_fold=2)
# a test based on the maximum mean discrepancy between the counterfactual distributions under A=1 and A=0
mmd_test(W,A,Y,num_fold=2)


# simulate data from null
dat = sim_data(n,setting='nonzeroBothSides',cos_parameter=0)
W = dat$W
A = dat$A
Y = dat$Y

# a test based on a weighted and standardized L2 statistic that contrasts the counterfactual density functions under A=1 and A=0
density_test(W,A,Y,num_fold=2)
# a test based on the maximum mean discrepancy between the counterfactual distributions under A=1 and A=0
mmd_test(W,A,Y,num_fold=2)

About

Implements the one-step estimators of Hilbert-valued parameters that were evaluated in the simulation study in Luedtke and Chung (2023)

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •  

Languages

0