Dear all,
I´m currently trying to implement a matching mechanism which selects a potential wife or husband from the same sample for an individual which is observed to be married, but has no partner information (partner ID).
In detail, I want to find a pool of potential partners with the help of the mahalanobis distance measure and then assign on of these potential partners randomly.
Am I right, that Mahapick is a good way to implement this approach?
My dataset consists of about 15.000 individuals. For which I want to simulate/impute their complete family situation between 1980 and 2000.
My panel dataset looks like this:
I want to build the distance measure on age, education and region.
Since I´m running a dynamic microsimulation model, partnering has to be done on a yearly basis. So for example if I simulate that a person marries in the year t, then I need to find a partner for this married individual in t.
So I only need to do the partnering for individuals who are married, but do not have an assigned partner in the specific year.
As far as I´m aware, there is no „if“ command function for Mahapick - right?
So how can I tell Stata to run the matching command only for individuals who are married and do not have an assigned partner in year `y’ ?
Since there is no „if command“, I unfortunately can not run something like:
And my last question is: What would be the "treated" variable here? Is it married, because we only want to match married individuals (with missing partner_id)?
Any help would be appreciated. Thank you very much in advance.
I´m currently trying to implement a matching mechanism which selects a potential wife or husband from the same sample for an individual which is observed to be married, but has no partner information (partner ID).
In detail, I want to find a pool of potential partners with the help of the mahalanobis distance measure and then assign on of these potential partners randomly.
Am I right, that Mahapick is a good way to implement this approach?
My dataset consists of about 15.000 individuals. For which I want to simulate/impute their complete family situation between 1980 and 2000.
My panel dataset looks like this:
Code:
* Example generated by -dataex-. To install: ssc install dataex clear input long id int year float married double age float education byte region long partner_id 12 1984 1 44 2 2 11 12 1985 1 45 2 2 11 12 1986 1 46 2 2 11 22 1984 0 28 6 5 0 22 1985 1 29 6 5 . 22 1986 . 30 6 5 . 25 1984 1 24 6 . . 25 1985 . 25 6 . . 25 1986 . 26 6 . . end
Since I´m running a dynamic microsimulation model, partnering has to be done on a yearly basis. So for example if I simulate that a person marries in the year t, then I need to find a partner for this married individual in t.
So I only need to do the partnering for individuals who are married, but do not have an assigned partner in the specific year.
As far as I´m aware, there is no „if“ command function for Mahapick - right?
So how can I tell Stata to run the matching command only for individuals who are married and do not have an assigned partner in year `y’ ?
Since there is no „if command“, I unfortunately can not run something like:
Code:
forval y= 1980/2000{ gen match_id = . mahapick age education region, idvar(id) treated (married) pickids(match_id) nummatches(5) if year==`y’“ & married==1 & part_id==. }
Any help would be appreciated. Thank you very much in advance.
Comment