Hi Statausers
I’m researching whether school teachers tend to be more generous in their grading based on gender. To explore this, I have two predictors of gender: one derived from an image recognition algorithm and another from calligraphy using an optical character recognition (OCR) model. Inspired by Angrist and Krueger (1995), I’d like to perform a split-sample instrumental variables (IV) analysis.
Is there a Stata package that facilitates split-sample IV estimation?
What I've done is:
Does anybody have any insight about this code? I couldn't find material to do this in Stata documentation.
Thanks a lot!
I’m researching whether school teachers tend to be more generous in their grading based on gender. To explore this, I have two predictors of gender: one derived from an image recognition algorithm and another from calligraphy using an optical character recognition (OCR) model. Inspired by Angrist and Krueger (1995), I’d like to perform a split-sample instrumental variables (IV) analysis.
Is there a Stata package that facilitates split-sample IV estimation?
What I've done is:
Code:
* Split the sample into two halves gen random = runiform() sort random gen half = (_n > _N/2) * First stage: Predict gender of the teacher using face image recognition in the first half of the sample reg gender_face gender_ocr other_covs if half == 1 predict gender_pred1 if half == 1 * Store the predictions gen gender_pred = . replace gender_pred = gender_pred1 if half == 1 * First stage: Predict gender using the second half of the sample reg gender_face gender_ocr other_covs if half == 0 predict gender_pred2 if half == 0 * Combine the predictions replace gender_pred = gender_pred2 if half == 0 * Second stage reg grades gender_pred other_covs
Thanks a lot!
Comment