cdensity: Doubly robust series estimation of counterfactual densities

Description Usage Arguments Value References Examples

View source: R/cdensity.R

Description

cdensity is used to estimate counterfactual densities, i.e., the density of the potential outcome in a population if everyone received given treatment levels, using doubly robust estimates of L2 projections of the density onto a linear basis expansion. Nuisance functions are estimated with random forests. The L2 distance between the density of the counterfactuals is also estimated as a density-based treatment effect.

Usage

1
2
3
cdensity(y, a, x, kmax=5, l2 = TRUE,
 gridlen=20, nsplits=2, progress_updates = TRUE,
 makeplot=TRUE, kforplot=5, ylim=NULL)

Arguments

y

outcome of interest.

a

binary treatment (more than 2 levels are allowed, but only densities under A=1 and A=0 will be estimated).

x

covariate matrix.

kmax

Integer indicating maximum dimension of (cosine) basis expansion that should be used in series estimator.

l2

A logical value indicating whether an estimate of the L2 distance between counterfactual densities (under A=1 vs A=0) should be returned.

gridlen

Integer number indicating length of grid for which the plug-in estimator of the marginal density is computed.

nsplits

Integer number of sample splits for nuisance estimation. If nsplits = 1, sample splitting is not used, and nuisance functions are estimated n full sample (in which case validity of standard errors and confidence intervals requires empirical process conditions). Otherwise must have nsplits > 1.

progress_updates

A logical value indicating whether to print a progress statement as various stages of computation reach completion. The default is TRUE, printing a progress bar to inform the user.

makeplot

A logical value indicating whether to print a plot.

kforplot

A vector of two integers indicating which k values to plot results for, with first argument for A=1 and second for A=0.

ylim

Range of y values at which density should be plotted.

Value

A list containing the following components:

res

estimates/SEs/CIs/p-values for population means and relevant contrasts.

nuis

subject-specific estimates of nuisance functions (i.e., propensity score and outcome regression)

ifvals

matrix of estimated influence function values.

References

Kennedy EH, Wasserman LA, Balakrishnan S. Semiparametric counterfactual density estimation. arxiv:TBA

Examples

1
2
3
4
n <- 100; x <- matrix(rnorm(n*5),nrow=n)
a <- sample(3,n,replace=TRUE)-2; y <- rnorm(n)

cdens.res <- cdensity(y,a,x)

ehkennedy/npcausal documentation built on Feb. 26, 2021, 2:43 a.m.