Hello,
I have been using MatchIt for a project and have some categorical
covariates. (I know that continuous covariates are optimal, but
unfortunately we only have categorical for some of our data). I have
already coded them so that the categories are numeric.
When I perform the matching and ask for the summary, sometimes it gives
balance measures for all of the levels of the categorical variable and
other times it does not. For example, my variable Class Standing is 4
levels and I get balance measures for all 4 levels, but my variable Current
GPA is 4 levels and I only get balance measures for the second, third, and
fourth level of the variable.
Is there a way to correct this?
Thank you,
Maureen Bowers
Hello all,
I am trying to match on 4 year bins around year of diagnosis, it seems like
no matter what cut points I specify (even none) I always get an exact match
on year of diagnosis. It is a numeric variable.
mat4 <- matchit(pc ~ TeachingHospital + sex + ageDx1 + YRDX1 + hrr +
dxtodeath, data=pa, method = "cem", cutpoints = list(ageDx1=8, sex=0,
dxtodeath=dxcut2, TeachingHospital=0, yrdx1=1), keep.all=TRUE)
Thank you,
Paige Sheridan, MPH
*UCSD-SDSU Joint Doctoral Program, Epidemiology*
(503) 720-6857
Hello,
I am working with the MatchIt package and was wondering if it is possible
to integrate it with Amelia II. Unfortunately, the only posts I found on
this subject in the e-mail archives were from 2009. I apologize if this has
already been discussed previously.
Is it possible to use all imputed data files on MatchIt's "data" argument?
Such as:
a.out <- amelia(df, m = 5, ts = "X1", cs = "X2")
m.out <- matchit(treat ~ X1 + X2, data = a.out$imputations,
method = "genetic")
Unfortunately, the "data" argument does not appear to accept amelia
objects, as far as I know. I would very much appreciate any advice on this.
Thank you.
Best,
Alessandro
Given the challenges that you note, I think you may be best off doing some exploration by hand of the potential comparison schools with the variables that you mentioned to see whether any candidate matches seem remotely plausible or at least close enough. If the 3 schools are the most extreme on those variables, especially if they are outliers on those variables, perhaps there are no good matches in the same state.
Perhaps there are states with policies that make them appropriate to use outlier schools from those states as controls: e.g., synthetic controls for these 3 schools as composition of several schools in other states.
Janet Rosenbaum, Ph.D.
Assistant Professor of Epidemiology
School of Public Health, SUNY Downstate Medical Center, Brooklyn, NY
janet.rosenbaum(a)downstate.edu
> On Apr 16, 2018, at 3:39 PM, matchit-request(a)lists.gking.harvard.edu wrote:
>
> Matching experts,
>
> I am trying to match a small treatment group of schools (n = 3) with
> controls using a ratio of 1:4. I am using Mahal distance.
> The co variates are at the school level, but the analyses are planned at
> the student level.
>
> The match faces huge challenges to start with.
> The three treatment school are among the most extreme in the state with
> regard to the covariates:
> the highest dropout highest minority, highest poverty and lowest academic
> performance.
>
> I am getting warnings as follows:
>
> Warning messages:
> 1: glm.fit: algorithm did not converge
> 2: glm.fit: fitted probabilities numerically 0 or 1 occurred .
>
> I wonder if there are ways to work around the lack of convergence and
> fitted probabilities at the extreme.
> In previous work with this group I tried propensity scoring but that was
> equally problematic in term sof std differences.
>
> Thanks for any help.
> Bill
Matching experts,
I am trying to match a small treatment group of schools (n = 3) with
controls using a ratio of 1:4. I am using Mahal distance.
The co variates are at the school level, but the analyses are planned at
the student level.
The match faces huge challenges to start with.
The three treatment school are among the most extreme in the state with
regard to the covariates:
the highest dropout highest minority, highest poverty and lowest academic
performance.
I am getting warnings as follows:
Warning messages:
1: glm.fit: algorithm did not converge
2: glm.fit: fitted probabilities numerically 0 or 1 occurred .
I wonder if there are ways to work around the lack of convergence and
fitted probabilities at the extreme.
In previous work with this group I tried propensity scoring but that was
equally problematic in term sof std differences.
Thanks for any help.
Bill
>
On Mon, Feb 26, 2018 at 4:31 PM, <matchit-request(a)lists.gking.harvard.edu>
wrote:
> Send Matchit mailing list submissions to
> matchit(a)lists.gking.harvard.edu
>
> To subscribe or unsubscribe via the World Wide Web, visit
> https://lists.gking.harvard.edu/mailman/listinfo/matchit
> or, via email, send a message with subject or body 'help' to
> matchit-request(a)lists.gking.harvard.edu
>
> You can reach the person managing the list at
> matchit-owner(a)lists.gking.harvard.edu
>
> When replying, please edit your Subject line so it is more specific
> than "Re: Contents of Matchit digest..."
>
>
> Today's Topics:
>
> 1. Re: MatchIt Question (Noah Greifer)
>
>
> ----------------------------------------------------------------------
>
> Message: 1
> Date: Mon, 26 Feb 2018 21:31:20 +0000
> From: Noah Greifer <noah.greifer(a)gmail.com>
> To: "Samadi, Mehrdad" <Mehrdad.Samadi(a)finra.org>
> Cc: "matchit(a)lists.gking.harvard.edu"
> <matchit(a)lists.gking.harvard.edu>
> Subject: Re: [matchit] MatchIt Question
> Message-ID:
> <CAPhhD8ma1szOPw9Zn_-5ber2E7jcovp9YgvK8cngT8bkVkrFx
> g(a)mail.gmail.com>
> Content-Type: text/plain; charset="utf-8"
>
> I'm not exactly sure what's going on with your code, but I think you could
> run the same analysis without splitting the data set and running 9
> separate analyses just be setting exact = "stock" in a single matchit()
> call. Then match.data() could be run on the single output object. cobalt's
> bal.tab() can help examine balance on the separate groups.
>
> Noah
>
> On Mon, Feb 26, 2018 at 12:20 PM Samadi, Mehrdad <Mehrdad.Samadi(a)finra.org
> >
> wrote:
>
> > Hi All,
> >
> >
> >
> > I?ve been working with your MatchIT function in R and have a question:
> >
> >
> >
> > I?m able to successfully run MatchIT on a list of dataframes using the
> > lapply function, which outputs a large list with a number of elements
> > corresponding to the number of separate MatchIT procedures that I ran,
> and
> > within each of these elements, 9 sub elements which correspond to the
> > standard output of MatchIt.
> >
> >
> >
> > While I can successfully extract summary information from this MatchIt
> > large list using the summary function and lapply or sapply, I?m having
> > difficulty extracting the matrices of matched observations from each
> > separate MatchIt procedure. I get the error message, ?invalid subscript
> > type ?closure?.
> >
> >
> >
> > Some more context is provide below, any insight that you have would be
> > helpful. Thanks for your time and consideration.
> >
> >
> >
> > The raw dataframe ?sample? has the following structure:
> >
> >
> >
> > *stock*
> >
> > *firm*
> >
> > *var*
> >
> > *treated*
> >
> >
> >
> >
> >
> >
> >
> >
> >
> > APPL
> >
> > A
> >
> > 0.5
> >
> > 1
> >
> > APPL
> >
> > B
> >
> > 0.54
> >
> > 0
> >
> > APPL
> >
> > C
> >
> > 0.33
> >
> > 0
> >
> > APPL
> >
> > D
> >
> > 0.38
> >
> > 0
> >
> > APPL
> >
> > E
> >
> > 0.88
> >
> > 0
> >
> > BAC
> >
> > A
> >
> > 0.5
> >
> > 0
> >
> > BAC
> >
> > B
> >
> > 0.54
> >
> > 1
> >
> > BAC
> >
> > C
> >
> > 0.33
> >
> > 0
> >
> > BAC
> >
> > D
> >
> > 0.38
> >
> > 0
> >
> > BAC
> >
> > E
> >
> > 0.88
> >
> > 0
> >
> > JPM
> >
> > A
> >
> > 0.5
> >
> > 0
> >
> > JPM
> >
> > B
> >
> > 0.54
> >
> > 1
> >
> > JPM
> >
> > C
> >
> > 0.33
> >
> > 0
> >
> > JPM
> >
> > D
> >
> > 0.38
> >
> > 0
> >
> > JPM
> >
> > E
> >
> > 0.88
> >
> > 0
> >
> >
> >
> >
> >
> > I want to use matchit for each stock separately, so I?m using a
> > combination of the split function and lapply:
> >
> >
> >
> > X <- split(sample,sample$stock)
> >
> >
> >
> > output <- lapply(names(X), function(n) {
> >
> > matchit(treated ~
> > var,data=X[[n]],method="nearest",distance="mahalanobis",replace=FALSE,
> ratio=1)})
> >
> >
> >
> > This would output a large list with 3 elements and within each of these 3
> > elements, another 9 elements corresponding to MatchIt output.
> >
> >
> >
> > I would like to extract the matrices corresponding to the matched
> > observations for each stock using match.data by again using lapply or
> > sapply, but get the following error:
> >
> >
> >
> > sapply(output,match.data)
> >
> >
> >
> > Error in X[[n]] : invalid subscript type 'closure'
> >
> >
> >
> > Best,
> >
> > Mehrdad
> > Confidentiality Notice:: This email, including attachments, may include
> > non-public, proprietary, confidential or legally privileged information.
> If
> > you are not an intended recipient or an authorized agent of an intended
> > recipient, you are hereby notified that any dissemination, distribution
> or
> > copying of the information contained in or transmitted with this e-mail
> is
> > unauthorized and strictly prohibited. If you have received this email in
> > error, please notify the sender by replying to this message and
> permanently
> > delete this e-mail, its attachments, and any copies of it immediately.
> You
> > should not retain, copy or use this e-mail or any attachment for any
> > purpose, nor disclose all or any part of the contents to any other
> person.
> > Thank you.
> > -
> > ---
> > MatchIt mailing list served by HUIT
> > List Address: matchit(a)lists.gking.harvard.edu
> > Subscribe/Unsubscribe: http://lists.gking.harvard.
> edu/mailman/listinfo/ei
> > MatchIt Software and Documentation: http://gking.harvard.edu/matchit/
> > Browse/Search <http://gking.harvard.edu/matchit/Browse/Search> List
> > Archive: http://lists.gking.harvard.edu/mailman/private/matchit/
> > Matchit mailing list
> > Matchit(a)lists.gking.harvard.edu
> >
> > To unsubscribe from this list or get other information:
> >
> > https://lists.gking.harvard.edu/mailman/listinfo/matchit
>
Hi All,
I've been working with your MatchIT function in R and have a question:
I'm able to successfully run MatchIT on a list of dataframes using the lapply function, which outputs a large list with a number of elements corresponding to the number of separate MatchIT procedures that I ran, and within each of these elements, 9 sub elements which correspond to the standard output of MatchIt.
While I can successfully extract summary information from this MatchIt large list using the summary function and lapply or sapply, I'm having difficulty extracting the matrices of matched observations from each separate MatchIt procedure. I get the error message, "invalid subscript type 'closure'.
Some more context is provide below, any insight that you have would be helpful. Thanks for your time and consideration.
The raw dataframe "sample" has the following structure:
stock
firm
var
treated
APPL
A
0.5
1
APPL
B
0.54
0
APPL
C
0.33
0
APPL
D
0.38
0
APPL
E
0.88
0
BAC
A
0.5
0
BAC
B
0.54
1
BAC
C
0.33
0
BAC
D
0.38
0
BAC
E
0.88
0
JPM
A
0.5
0
JPM
B
0.54
1
JPM
C
0.33
0
JPM
D
0.38
0
JPM
E
0.88
0
I want to use matchit for each stock separately, so I'm using a combination of the split function and lapply:
X <- split(sample,sample$stock)
output <- lapply(names(X), function(n) {
matchit(treated ~ var,data=X[[n]],method="nearest",distance="mahalanobis",replace=FALSE,ratio=1)})
This would output a large list with 3 elements and within each of these 3 elements, another 9 elements corresponding to MatchIt output.
I would like to extract the matrices corresponding to the matched observations for each stock using match.data by again using lapply or sapply, but get the following error:
sapply(output,match.data)
Error in X[[n]] : invalid subscript type 'closure'
Best,
Mehrdad
Confidentiality Notice:: This email, including attachments, may include non-public, proprietary, confidential or legally privileged information. If you are not an intended recipient or an authorized agent of an intended recipient, you are hereby notified that any dissemination, distribution or copying of the information contained in or transmitted with this e-mail is unauthorized and strictly prohibited. If you have received this email in error, please notify the sender by replying to this message and permanently delete this e-mail, its attachments, and any copies of it immediately. You should not retain, copy or use this e-mail or any attachment for any purpose, nor disclose all or any part of the contents to any other person. Thank you.