[R] generating LaTeX tables from Match output

Brian Quinif bquinif at gmail.com
Tue Apr 4 20:05:08 CEST 2006


Dear R users,

I am using the Match function to generate nearest neighbor matching
estimators.  On that front I am ok, but where I am having problems is
getting my output into nice LaTeX tables.

Here is some basic code imitating the estimation I'm doing.  No problem there.

library(Matching)

#make up some data
X1 <- matrix(rnorm(1000*5), ncol=5)
Y1 <- as.vector(rnorm(1000))
Tr1 <- c(rep(1,500),rep(0,500))

#estimate nearest neighbor, 1-1 matching, ATT
a <- Match(Y=Y1, X=X1, Tr=Tr1, M=1)
summary(a)

#make up some more data
X2 <- matrix(rnorm(1000*5), ncol=5)
Y2 <- as.vector(rnorm(1000))
Tr2 <- c(rep(1,500),rep(0,500))
b <- Match(Y=Y2, X=X2, Tr=Tr2, M=1)
summary(b)

I have tried the xtable and latex functions but have not been able to
get what I wanted.  One thing you should know if you are unfamiliar
with Match is that it only generates *one* estimator.  What I want to
do is take the coefficient a (along with its SE) and the coefficient
in b (along with its SE) and put them into a nice table.  Once I get
that accomplished, I'll worry about titles, etc.  Eventually, though,
I will want to put the results from many (say, 10) estimations in one
table.  If anyone has some recommended code, I'd really appreciate it.

Thanks,

Brian




More information about the R-help mailing list