Thanks Peter,
I figured it out--
dim(all) returned 219 columns, but I only had 217 columns of data. Must
have been that R was trying to read some of the blank columns at the end,
and thus returning the undefined column error because they had no data. I
therefore used the command you suggested allr<-all[1:1460,1:217] with a
dimension of two fewer columns, which truncated the bad columns at the end.
Toby
On Fri, Jul 24, 2009 at 5:40 AM, Lugtig, P. (Peter) <p.lugtig(a)uu.nl> wrote:
Dear Toby,
I encountered a similar problem a couple of months ago. I have never really
understood how and why this error occurred, but in my case there was a
problem in extracting singular variables from the data matrix (all). Perhaps
you could try the following:
# Ask for the dimensions of the data matrix
dim(all)
# Use these dimensions to manually create the dimensions of your matrix
allr <- all[1:4032,1:19] # the dimensions I used are only an example, use
the dimensions you get from R
Subsequently, run the matchit code again. In my case it worked....
my two cents,
Peter Lugtig
------------------------------
*From:* owner-matchit_at_lists_gking_harvard_edu(a)mail.hmdc.harvard.edu[mailto:
owner-matchit_at_lists_gking_harvard_edu(a)mail.hmdc.harvard.edu] *On Behalf
Of *Toby Edison
*Sent:* Friday, July 24, 2009 4:30 AM
*To:* matchit(a)lists.gking.harvard.edu
*Subject:* [matchit] match.data undefined columns selected error
I am having a problem getting the match.data function to work on my data.
Just getting started with matchit, but cannot seem to get the match.data
function to work on my data. I am using a Mac.
Here is the code I use:
all<-read.table("file:///all.txt", header = TRUE, sep = "\t",
quote="\"",
dec=".")
m.out <- matchit(wins03 ~ firstcontractyear + foundingyear + employees +
top_no + sub03 + prime03 + tns2002 + ts2002+ phiiawards + phiawards + cai,
data = all, method = "cem")
m.data <- match.data(m.out)
z.out1<-zelig(tns05 ~ wins03+ tns2002 + ts2002 + tns03 + foundingyear +
employees + sub03 + prime03 + phiiawards + phiawards + cai, data = m.data,
model="ls")
resulting in :
Error in `[.data.frame`(d, , all.vars(as.expression(formula))) :
undefined columns selected
match.data works fine with the lalonde data set but I cannot get it to work
with my imported data. I've saved my data from an excel spreadsheet
into a tab delimited text file. I've tried using .csv imports as well.
Any ideas.
Toby Edison