I've changed the Stata file to use the encode function for sex (as it's one line instead of 4), which has also switched which group is 1 and which is 2. The order now matches the way that the R regression does it.
The R model output matches the odds ratios of the Stata model closely, but not exactly. Differences are possibly due to different ways that the model functions generate coefficients (though I can't really elaborate much). If we need them to match exactly, we can investigate further once we know with more certainty the model functions we're going to use.
I've changed the Stata file to use the
encode
function for sex (as it's one line instead of 4), which has also switched which group is 1 and which is 2. The order now matches the way that the R regression does it.The R model output matches the odds ratios of the Stata model closely, but not exactly. Differences are possibly due to different ways that the model functions generate coefficients (though I can't really elaborate much). If we need them to match exactly, we can investigate further once we know with more certainty the model functions we're going to use.