I think that my last question has nothing to do with logical values as
a treatment. Instead, there seems to be an issue with single
covariates. Consider:
> data(lalonde)
> foo1 <- matchit(treat ~ black, exact = TRUE, data = lalonde)
Exact matching...Done
Calculating summary statistics...Done
> foo1
Assignment model specification:
matchit(formula = treat ~ black, data = lalonde, exact = TRUE)
Sample sizes for full and exactly matched data:
Treated Control Total
Full 185 429 614
Matched 185 429 614
> summary(foo1)
Error in covariates[qi, ][1, ] : incorrect number of dimensions
> traceback()
3: as.numeric(covariates[qi, ][1, ])
2: summary.matchit(foo1)
1: summary(foo1)
>
The example in the manual, with both black and hispan as covariates
does work for me.
Am I missing something? Feel free to ignore my previous e-mail since I
used a single covariate in that case as well.
Dave
--
David Kane
Kane Capital Management
646-644-3626
-
MatchIt mailing list served by Harvard-MIT Data Center
List Address: matchit(a)latte.harvard.edu
Subscribe/Unsubscribe: http://lists.hmdc.harvard.edu/?info=matchit
MatchIt Software and Documentation: http://gking.harvard.edu/matchit/
I tend to code my treatment variables as logical. In this dataset, the
variable is "assay" and there are 52 treated and 3263 untreated. The
analysis works at the beginning but fails at the summary stage.
> dim(y)
[1] 3315 3
> names(y)
[1] "ret" "assay" "f.sector"
> summary(y)
ret assay f.sector
Min. :-44.74 Mode :logical Finance : 623
1st Qu.: -1.52 FALSE:3263 Electronic Technology: 428
Median : 3.39 TRUE :52 Health Technology : 355
Mean : 3.43 Technology Services : 236
3rd Qu.: 8.67 Consumer Services : 199
Max. : 97.45 Retail Trade : 177
(Other) :1297
> foo1 <- matchit(assay ~ f.sector, exact = TRUE, data = y) # Looks fine
Exact matching...Done
Calculating summary statistics...Done
> foo1 # reasonable results
Assignment model specification:
matchit(formula = assay ~ f.sector, data = y, exact = TRUE)
Sample sizes for full and exactly matched data:
Treated Control Total
Full 52 3263 3315
Matched 52 1973 2025
> summary(foo1) # fails
Error in x * w : non-numeric argument to binary operator
In addition: Warning messages:
1: argument is not numeric or logical: returning NA in: mean.default(x1)
2: argument is not numeric or logical: returning NA in: mean.default(x0)
> traceback()
6: sum(x * w)
5: weighted.mean(X.t.m, ww[tt == 1][ww[tt == 1] > 0])
4: FUN(newX[, i], ...)
3: apply(covariates, 2, qoi, tt = treat, ww = weights)
2: summary.matchit(foo1)
1: summary(foo1)
>
Looks like later stages require that the treatment variable be
numeric. I would say that this is a bug rather than a feature.
> packageDescription("Matchit")
Package: Matchit
Version: 0.1-4
Date: 2004-06-20
Title: MatchIt
Author: Daniel Ho <deho(a)fas.harvard.edu>, Elizabeth Stuart <stuart(a)stat.harvard.edu>, Kosuke Imai
<kimai(a)Princeton.Edu>, Gary King <king(a)harvard.edu>
Maintainer: Daniel Ho <deho(a)fas.harvard.edu>
Depends:
Description: MatchIt selects matched samples of the the original treated and control groups with similar covariate
distributions -- can be used to match exactly on covariates, to match on propensity scores, or perform
a variety of other matching procedures.
License: GPL
URL: http://gking.harvard.edu/matchit/
Packaged: Sun Jun 20 18:04:21 2004; king
Built: R 1.9.1; ; 2004-07-19 14:54:07; unix
-- File: /home/dkane/rlib/Matchit/DESCRIPTION
> R.version
_
platform i686-pc-linux-gnu
arch i686
os linux-gnu
system i686, linux-gnu
status
major 1
minor 9.1
year 2004
month 06
day 21
language R
>
--
David Kane
Kane Capital Management
646-644-3626
-
MatchIt mailing list served by Harvard-MIT Data Center
List Address: matchit(a)latte.harvard.edu
Subscribe/Unsubscribe: http://lists.hmdc.harvard.edu/?info=matchit
MatchIt Software and Documentation: http://gking.harvard.edu/matchit/
I have two questions:
1) I am having trouble installing matchit.
> install.packages("matchit", lib = "~/rlib/", CRAN = "http://gking.harvard.edu")
trying URL `http://gking.harvard.edu/src/contrib/PACKAGES'
Content type `text/plain' length 1837 bytes
opened URL
.
downloaded 1837 bytes
Warning message:
No package "matchit" on CRAN. in: download.packages(pkgs, destdir = tmpd, available = available,
>
I don't think that it is anything on my end since I can install Zelig
without a problem. If someone could make the version 0.1-4 tar ball
available, I could install that myself.
2) I have read through and enjoyed the user manual. I have noticed
some typos. I could send them to this list or, perhaps better, provide a
patch to the latex, if the .tex file were available for download
somewhere.
Thanks,
Dave Kane
--
David Kane
Kane Capital Management
646-644-3626
-
MatchIt mailing list served by Harvard-MIT Data Center
List Address: matchit(a)latte.harvard.edu
Subscribe/Unsubscribe: http://lists.hmdc.harvard.edu/?info=matchit
MatchIt Software and Documentation: http://gking.harvard.edu/matchit/