Stata allows you to fit multilevel mixed-effects probit models with meprobit. A multilevel mixed-effects probit model is an example of a multilevel mixed-effects generalized linear model (GLM). You can fit the latter in Stata using meglm.
Let's fit a crossed-effects probit model. A crossed-effects model is a multilevel model in which the levels of random effects are not nested. We investigate the extent to which two salamander populations, whiteside and roughbutt, cross-breed. We label whiteside males wsm, whiteside females wsf, roughbutt males rbm, and roughbutt females rbf. Our dependent variable y is coded 1 if there was a successful mating and 0 otherwise. Let's fit our model:
. webuse salamander . meprobit y wsm##wsf || _all: R.male || female: note: crossed random-effects model specified; option intmethod(laplace) implied Fitting fixed-effects model: Iteration 0: log likelihood = -223.01026 Iteration 1: log likelihood = -222.78736 Iteration 2: log likelihood = -222.78735 Refining starting values: Grid node 0: log likelihood = -216.49485 Fitting full model: Iteration 0: log likelihood = -216.49485 (not concave) Iteration 1: log likelihood = -214.34477 Iteration 2: log likelihood = -209.90745 Iteration 3: log likelihood = -208.25543 Iteration 4: log likelihood = -208.11848 Iteration 5: log likelihood = -208.11715 Iteration 6: log likelihood = -208.11259 Iteration 7: log likelihood = -208.11187 Iteration 8: log likelihood = -208.11182 Iteration 9: log likelihood = -208.11182 Mixed-effects probit regression Number of obs = 360
No. of Observations per Group | ||
Group Variable | Groups Minimum Average Maximum | |
_all | 1 360 360.0 360 | |
female | 60 6 6.0 6 | |
y | Coef. Std. Err. z P>|z| [95% Conf. Interval] | |
1.wsm | -.4121977 .2735675 -1.51 0.132 -.9483802 .1239847 | |
1.wsf | -1.720323 .3223052 -5.34 0.000 -2.35203 -1.088617 | |
wsm#wsf | ||
1 1 | 2.121115 .3611665 5.87 0.000 1.413242 2.828989 | |
_cons | .5950942 .2350714 2.53 0.011 .1343628 1.055826 | |
_all>male | ||
var(_cons) | .3867491 .1789793 .156139 .95796 | |
female | ||
var(_cons) | .4464111 .1976024 .1874794 1.062959 | |
Our model has two random-effects equations, separated by ||. We use the _all notation that identifies all the observations as one big group. We use the R. notation to tell Stata to treat male as an indicator variable.
The output table includes the fixed-effect portion of our model and the estimated variance components. The estimates of the random intercepts suggest that the heterogeneity among the female salamanders is larger than the heterogeneity among the male salamanders.
If we wish, we can constrain the two random intercepts to be equal.
. constraint 1 _b[/var(_cons[_all>male])] = _b[/var(_cons[female])] . meprobit y wsm##wsf || _all: R.male || female:, constraint(1) nolog note: crossed random-effects model specified; option intmethod(laplace) implied Mixed-effects probit regression Number of obs = 360
No. of Observations per Group | ||
Group Variable | Groups Minimum Average Maximum | |
_all | 1 360 360.0 360 | |
female | 60 6 6.0 6 | |
y | Coef. Std. Err. z P>|z| [95% Conf. Interval] | |
1.wsm | -.4131745 .2697393 -1.53 0.126 -.9418539 .1155048 | |
1.wsf | -1.720811 .3141051 -5.48 0.000 -2.336446 -1.105177 | |
wsm#wsf | ||
1 1 | 2.119462 .3570329 5.94 0.000 1.41969 2.819234 | |
_cons | .5965032 .2237045 2.67 0.008 .1580504 1.034956 | |
_all>male | ||
var(_cons) | .4156343 .1488829 .2059706 .8387207 | |
female | ||
var(_cons) | .4156343 .1488829 .2059706 .8387207 | |
You can also fit our model using a logit model (see melogit) or a complementary log-log model (see mecloglog).
Also watch A tour of multilevel GLMs.