Learn R Programming

SVMMatch (version 1.1)

svmmatch: SVMMatch for Causal Effect Estimation

Description

svmmatch estimates balancing weights in the presence of non-random treatment assignment. The method allows the researcher to assess the two crucial ignorability assumptions: a test of sensitivity to omitted confounders and a test of common support between treated and control. A fully Bayesian implementation allows characterization of the posterior of the treatment effect. The method is implemented in C++ through Rcpp, greatly speeding calculation time.

Usage

svmmatch(treat, X, burnin = 100, gibbs = 200, thin = 2, dv = NULL)

Arguments

treat
A binary vector indicating treatment status.
X
A covariate matrix.
burnin
Number of burnin draws for the Gibbs sampler.
gibbs
Number of posterior draws to be saved.
thin
Number of chains when thinning. If burnin = 10, gibbs = 20, and thin=30,then 500 = 10 x 30 + 20 x 30 samples will be drawn, but only 20 returned.
dv
A dependent variable of interest. Optional.

Value

effect
Posterior density of treatment effect on dv.
beta
Matrix of posterior draws for coefficients.
margin
Binary vector for posterior estimate of marginal observations.
bal.wts
Balancing weights.
X.scale
Scaled covariate matrix. Used internally.
X.orig
Original matrix of covariates.
treat
Treatment vector.
dv
The dependent variable.

Details

Fits SVMMatch to the data, returning balancing weights and a posterior density of the estimated effect.

References

Ratkovic, Marc. 2014. "Balancing within the Margin: Causal Effect Estimation with Support Vector Machines." Working paper.

See Also

balance, effect, sensitivity, control.overlap, treatment.overlap, LaLonde

Examples

Run this code

##Load data
	data("LaLonde")
	Data1<-LaLonde
	Data1<-Data1[Data1$exper==0|Data1$treat==1,]
	attach(Data1)	

##Format X matrix
	varnames<-c("age","educ","black","married","nodegr","hisp",
		"re75","re74")
	X<-cbind(Data1[,varnames],Data1$re75==0,Data1$re74==0)
	X<-as.matrix(X)

##Fit model
	set.seed(1)
	m1.param<-svmmatch(treat, X, dv=re78, burnin=100, gibbs=100, thin=5)

##Assess balance
	bal1<-balance(treat, X, m1.param)

##Summarize treatment effect
	effect1<-effect(m1.param)

## Not run: 
# ##Sensitivity analysis (Takes a little longer)
# 	sens1<-sensitivity(m1.param)
# 	## End(Not run)

##Assess ignorability:	
	#Assess control overlap--are there enough
	#controls to balance the treated?
		cont1<-control.overlap(m1.param)	

	#Assess treatment overlap--are there treated 
	#values that can't be matched?
		treat1<-treatment.overlap(m1.param)

##Assess autocorrelation
	ac1<-autocorr(m1.param)

Run the code above in your browser using DataLab