[R] Problem with matchit() and zelig()

F.Giammarino at lse.ac.uk F.Giammarino at lse.ac.uk
Tue Jan 25 14:38:28 CET 2011


Dear all,

Does anybody know why the following code returns an error message?

>library(MatchIt)
>library(Zelig)
>data(lalonde)
>
>m.out1<-matchit(treat~age+educ+black+hispan+nodegree+married
+re74+re75, method="full", data=lalonde)
>
>z.out1<-zelig(re78~age+educ+black+hispan+nodegree+married+re74+re75,
data=match.data(m.out1, "control"), model="ls" , weights="weights" )
>
>x.out1<-setx(z.out1, data=match.data(m.out1, "treat"), cond=T )
>
>s.out1<-sim(z.out1, x=x.out1)
>
Error in model.frame.default(formula = re78 ~ age + educ + black +
hispan +  : 
  variable lengths differ (found for '(weights)')


I noticed that the problem disappears if either the option
weights="weights" in the zelig() function or the option cond=T in the
setx() function is removed. 

Is there a conflict between the options weights="weights" in zelig() and
cond=T in setx()/sim()?

Or is there an inconsistency in my syntax? 

Any suggestion would be very much appreciated. 

Best wishes, 
Flavia Giammarino
London School of Economics, UK 





Please access the attached hyperlink for an important electronic communications disclaimer: http://lse.ac.uk/emailDisclaimer



More information about the R-help mailing list