[R] matchit - can I weight the parameters?

Nordlund, Dan (DSHS/RDA) NordlDJ at dshs.wa.gov
Wed Jun 20 01:51:24 CEST 2012


You can set the exact= parameter in your call to matchit.  That will force an exact match on the value of Stage.

match = matchit(Group ~ Stage + Age + Gender + PS, myData, method="optimal", exact=c(Stage))


Hope this is helpful,

Dan

Daniel J. Nordlund
Washington State Department of Social and Health Services
Planning, Performance, and Accountability
Research and Data Analysis Division
Olympia, WA 98504-5204

> -----Original Message-----
> From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-
> project.org] On Behalf Of Polwart Calum (COUNTY DURHAM AND DARLINGTON
> NHS FOUNDATION TRUST)
> Sent: Tuesday, June 19, 2012 4:37 PM
> To: r-help at r-project.org
> Subject: [R] matchit - can I weight the parameters?
> 
> This may be a really obvious question but I just can't figure out how
> to do it.
> 
> I have a small dataset that I am trying to compare to some controls.
> It is essential that the controls are matched on Cancer Stage (a
> numerical factor between 1 and 4), and then ideally on Age (integer),
> Gender (factor), Performance Status(factor).
> 
> I'm using matchit to try and do this, but it seems to give equal
> priority to all my variables so I can be relatively well matched on
> Age, Sex and PS but not exactly matched on Stage.  Stage is the biggest
> influence on outcome... so I must match it as close to perfect as
> possible even if that means dropping some data from the 'treatment'
> group.
> 
> Here's some code:
> 
> match = matchit(Group ~ Stage + Age + Gender + PS, myData,
> method="optimal")
> matchedData = match.data(match)
> by (matchedData$Stage, matchedData$Group, table)
> 
> matchedData$GP: 0
> 
>  1 3A 3B  4
>  1  6   9  10
> -----------------------------------------------------------------------
> ---------------------------------
> myreData$GP: 1
> 
>  1 3A 3B  4
>  1  3   9  13
> 
> Can anyone point me to a method that tells R to prioritise Stage over
> the others?
> Thanks in advance
> 
> ***********************************************************************
> *********************************************
> 
> This message may contain confidential information. If
> yo...{{dropped:19}}
> 
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-
> guide.html
> and provide commented, minimal, self-contained, reproducible code.



More information about the R-help mailing list