Dear members of the list,

I am using xtmelogit for explaining the probability of attaining a MA-level diploma versus a BA-level diploma among people with some university-level degree in 29 countries participating in the Survey of Adult Skills (PIAAC) carried out some years ago by the OECD. A key independent variable at the individual level is father's education.

There is an obvious selection issue here. The effect of social origin (father's education) on the probability of attaining a MA-level diploma vs. BA-level diploma is conditional on entry into university, and this in turn is explained by social origin. It is reasonable to assume that there has been some social selection at entry into university, and that such a social selection is not homogeneous across countries.

As a preliminary way of controlling this selection effect, I have thought of running a logistic regression for each country of analysis, regressing the probability of getting some university degree on father's education. I would then store the coefficients (betas) corresponding to father's education for each country. Finally, I would use these coefficients as country-level controls in the multilevel logistic regression aimed at explaining the probability of attaining a MA-level vs a BA-level diploma.

I have learnt to use parmby in order to create a dataset with the coefficients resulting from running a logistic regression for each country

That's fine. But I believe that getting the marginal effect of the different categories of father's education would be more correct than the coefficients.

In other words, I am interested in saving, if possible, the marginal effects of the different categories of father's education, not the coefficients.

Thanks for your attention

Luis Ortiz

I am using xtmelogit for explaining the probability of attaining a MA-level diploma versus a BA-level diploma among people with some university-level degree in 29 countries participating in the Survey of Adult Skills (PIAAC) carried out some years ago by the OECD. A key independent variable at the individual level is father's education.

There is an obvious selection issue here. The effect of social origin (father's education) on the probability of attaining a MA-level diploma vs. BA-level diploma is conditional on entry into university, and this in turn is explained by social origin. It is reasonable to assume that there has been some social selection at entry into university, and that such a social selection is not homogeneous across countries.

As a preliminary way of controlling this selection effect, I have thought of running a logistic regression for each country of analysis, regressing the probability of getting some university degree on father's education. I would then store the coefficients (betas) corresponding to father's education for each country. Finally, I would use these coefficients as country-level controls in the multilevel logistic regression aimed at explaining the probability of attaining a MA-level vs a BA-level diploma.

I have learnt to use parmby in order to create a dataset with the coefficients resulting from running a logistic regression for each country

PHP Code:

```
parmby "logit univ i.edufath", by(cntryid) saving("[file name]", replace)
```

In other words, I am interested in saving, if possible, the marginal effects of the different categories of father's education, not the coefficients.

**Do you know if there is any possibility of using margins with parmby?**Thanks for your attention

Luis Ortiz