Quantcast

matchit - can I weight the parameters?

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

matchit - can I weight the parameters?

Polwart Calum (County Durham and Darlington NHS Foundation Trust)
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}}

______________________________________________
[hidden email] 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.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: matchit - can I weight the parameters?

Nordlund, Dan (DSHS/RDA)
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: [hidden email] [mailto:r-help-bounces@r-
> project.org] On Behalf Of Polwart Calum (COUNTY DURHAM AND DARLINGTON
> NHS FOUNDATION TRUST)
> Sent: Tuesday, June 19, 2012 4:37 PM
> To: [hidden email]
> 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}}
>
> ______________________________________________
> [hidden email] 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.

______________________________________________
[hidden email] 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.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: matchit - can I weight the parameters?

Nordlund, Dan (DSHS/RDA)
In reply to this post by Polwart Calum (County Durham and Darlington NHS Foundation Trust)
Sorry, Stage should be in quotes in the exact= parameter

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


Hope this is more 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: Nordlund, Dan (DSHS/RDA)
> Sent: Tuesday, June 19, 2012 4:51 PM
> To: [hidden email]
> Subject: RE: matchit - can I weight the parameters?
>
> 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: [hidden email] [mailto:r-help-bounces@r-
> > project.org] On Behalf Of Polwart Calum (COUNTY DURHAM AND DARLINGTON
> > NHS FOUNDATION TRUST)
> > Sent: Tuesday, June 19, 2012 4:37 PM
> > To: [hidden email]
> > 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}}
> >
> > ______________________________________________
> > [hidden email] 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.

______________________________________________
[hidden email] 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.
Loading...