Dear Stata-listers,
I am trying to compare characteristics between two groups. However these two groups have different survival (number of events and time to event), which might confound my analysis.
Therefore, I would like to match these two groups on event and time to event. Now, one group has 150 individuals while the other has 2500 individuals.
In this scenario I would like to do a nearest to neighbour matching (1:1) based on event and time to event, so that I will end up with two groups of both 150 individuals which were randomly matched.
To perform any further analysis, I would need an identifier variable after matching, so that I can exclude the non matched individuals from the analysis (drop if missing)
To do this, I have looked at multiple packages, such as ccmatch (available on ssc), however ccmatch only provides for exact matching and not for nearest to neighbour matching.
Following, I have started using the package psmatch2, with the following syntax:
This provides me with an _id variable to identify groups, however this variable gives me the value 1 for all observations and does not effectively identify groups. Now my questions to you are:
1. is this the correct package or would you advise another package?
2. If this is the correct package, do you have any suggestions on where I went wrong?
I would like to thank you in advance for your time and consideration.
Best,
Jasper
I am trying to compare characteristics between two groups. However these two groups have different survival (number of events and time to event), which might confound my analysis.
Therefore, I would like to match these two groups on event and time to event. Now, one group has 150 individuals while the other has 2500 individuals.
In this scenario I would like to do a nearest to neighbour matching (1:1) based on event and time to event, so that I will end up with two groups of both 150 individuals which were randomly matched.
To perform any further analysis, I would need an identifier variable after matching, so that I can exclude the non matched individuals from the analysis (drop if missing)
To do this, I have looked at multiple packages, such as ccmatch (available on ssc), however ccmatch only provides for exact matching and not for nearest to neighbour matching.
Following, I have started using the package psmatch2, with the following syntax:
Code:
set seed 123456 gen u=uniform() sort u psmatch2 sex time_to_event event
1. is this the correct package or would you advise another package?
2. If this is the correct package, do you have any suggestions on where I went wrong?
I would like to thank you in advance for your time and consideration.
Best,
Jasper