## What’s this about?

We call them ERMs—extended regression models. There are four new commands that fit

- linear models
- linear models with interval-censored outcomes, including tobit models
- probit models
- ordered probit models

with any combination of

- endogenous covariates
- sample selection
- nonrandom treatment assignment, both exogenous and endogenous

Here are some of the features in discipline-specific terminology:

- bias due to unmeasured confounding
- trials with informative dropout
- causal inference
- average causal effects (ACEs)
- average treatment effects (ATEs)
- simultaneous causality, in linear models
- outcomes that are missing not at random (MNAR)
- nonignorable nonresponse
- selection on unobservables
- Heckman selection

All the above are addressed by one or more of endogenous covariates, sample selection (missingness), and nonrandom treatment assignment. ERMs are not black magic. ERMs let you model the problems that your data have.

## Easy syntax

The syntax of ERMs is a command, such as **eregress**, followed by the main equation and then followed by one or more of the options **endogenous()**, **select()**, and **entreat()** or**extreat()**. The options may be specified in any combination. For instance,

Linear regression of y on x1 and x2.eregress y x1 x2Make covariate x2 endogenous. eregress y x1 ,endogenous( x2 = x3 x4)Add sample selection. eregress y x1 , endogenous( x2 = x3 x4)select(selected = x2 x6)Add exogenous treatment & drop sample selection. eregress y x1 , endogenous( x2 = x3 x4)extreat(treated)Replace exogenous with endogenous treatment. eregress y x1 , endogenous( x2 = x3 x4)entreat( treated = x2 x3 x5)Add sample selection. eregress y x1 , endogenous( x2 = x3 x4)entreat( treated = x2 x3 x5)select(selected = x2 x6)

Look carefully, and you will notice that we specified endogenous covariates in both selection and treatment equations. That ERMs can fit such models is remarkable. ERMs have one syntax and four options. The **endogenous()** option can be repeated when necessary:

Make x2 and x3 endogenous. eregress y x1, endogenous(x2 = x3 x4) endogenous(x3 = x1 x5)

Endogenous variable **x3** in this example appears in the equations for both **y** and **x2**. If **x3**was not to appear in the main equation, we would have typed

Remove x3 from the main equation. eregress y x1, endogenous(x2 = x3 x4) endogenous(x3 = x1 x5,nomain)

Even when we specify **nomain**, we can include the variables in the main equation as long as we do so explicitly:

. eregress y x1x2 x3, endogenous(x2 = x3 x4,nomain) endogenous(x3 = x1 x5,nomain)

The same syntax that works with **eregress** to fit linear regression models also works with**eintreg** to fit interval regression models, **eprobit** to fit probit models, and **eoprobit** to fit ordered probit models. For instance,

y is binary, model is probit.eprobity x1, endogenous(x2 = x3 x4) endogenous(x3 = x1 x5, nomain)

There is only one more thing to know. Endogenous equations can themselves be probit or ordered probit. In the following model, endogenous covariate **x3** is binary, and it is modeled using probit:

x3 is now a binary endogenous covariate. eprobit y x1, endogenous(x2 = x3 x4) endogenous(x3 = x1 x5, nomainprobit)

## Let’s see it work

We are going to fit the following model:

. eregress bmi sex steps , endog(steps = sex distance, nomain) select(selected = sex steps education)

We will build up to fitting the model by relating the fictional story behind it, but first, notice that variable **steps** is endogenous and appears in both the main equation and the selection equation. We will have to account for that endogeneity if we hope to draw a causal inference about the effect of walking on body mass index.

. eregress bmi sexsteps, endog(steps = sex distance, nomain) select(selected = sexstepseducation)

Can ERMs really fit such models? Yes. We ran the model on simulated data and verified that the coefficients we are about to show you match the true parameters. Can other commands of Stata fit the same models as ERMs? Sometimes. There is no other Stata command that will fit a linear model with selection *and with an endogenous covariate*, but if variable **steps** were not endogenous, we could fit the model using Stata’s **heckman**command. Nonetheless, ERMs are easier to use. And ERMs provide a richer set of model-interpretation features. Regardless, the important feature of ERMs is that they will fit a wider range of models, like the one we are about to fit:

. eregress bmi sex steps , endog(steps = sex distance, nomain) select(selected = sex steps education)

The story behind this model concerns a (fictional) national study on the benefits of walking. This study is intended to measure those benefits in terms of the effects of steps walked per day (**steps**) on body-mass index (**bmi**).

A random sample was drawn and people were recruited to join the experiment. Some declined. We are going to ignore any bias in that. If they agreed, however, they were weighed, their height measured, their educational level recorded, and they were given a pedometer to be returned by prepaid post after six weeks. Some never returned it.

Our statistical concern is that those who did not return the pedometer might be systematically different from those who did. Perhaps they are less likely to exercise. Perhaps their **bmi** is higher than average. Remember that our goal is to measure the relationship between **bmi** and **steps** for the entire population.

Our other statistical concern has to do with unmeasured healthiness. People who walk more may be engaging in other activities that improve their health. We are worried that we have unobserved confounders. Said differently, we are worried that the error in **bmi** is correlated with the number of steps walked and thus **bmi** is endogenous.

We fit the model. Here are the results:

The parameter estimates are presented in five parts.

The first part reports the **bmi** equation.

The second part reports the **selected** equation.

The third part reports the **steps** equation.

The fourth part reports the error variances.

The fifth part reports the correlations between errors.

Let’s start with the last part.

We worried that the errors in **steps** and **bmi** would be positively correlated, both being affected by unobserved healthiness. The output reports that the errors are indeed correlated. The estimated **corr(e.steps, e.bmi)** is 0.6, and it is whoppingly significant.

We worried that the error in **selected** would be correlated with the error in **bmi**, and it is. The estimated **corr(e.selected, e.bmi)** is 0.67, and it is significant too.

Our concerns are justified by the data, and, because we specified options **selected()** and **endogenous()**, the results reported in the main equation are adjusted for them. The results reported for the **bmi** equation are just as if we fit the model using ordinary regression on randomly selected data that had none of these problems.

The coefficient in the **bmi** equation that most interests us is the coefficient on **steps**. It is -2.23, meaning that **bmi** is reduced by 2.23 for every 1,000 steps walked per day. This is not a small effect. The average **bmi** in our data is 23.

Was it important that we accounted for endogeneity and selection? To show you that it was, we ran three other models:

. eregress bmi sex steps . eregress bmi sex steps , endog( steps = sex distance, nomain) . eregress bmi sex steps , select(selected = sex steps education)

The coefficients on **steps** were different in each model and not a single 95 percent confidence included -2.3, the true value under which the data were simulated.

## Let’s see it work again

Treatment-effect models are popular these days, and for good reason. Much of what researchers do involves evaluations of the effects of drugs, treatments, or programs.

In social sciences, evaluations are usually performed on observational data, another word for naturally occurring data. Even when data are custom to the purpose, they are seldom from well-controlled experiments. People opt in or out voluntarily. Even those who volunteer may not honor their obligations.

Consider the plight of a fictional university wanting to evaluate its freshman program intended to increase students’ probabilities of ultimate graduation. This is a classic treatment-effects problem. Some students were treated (took the program) and others were not. The university now wants to measure the effect of the program.

The program was voluntary, meaning that students who are highly motivated might be more likely to participate. If highly motivated students are more likely to graduate in any case and if we ignored this problem, then the program would appear to affect college graduation rates more than it really does.

To measure the effect of the program, we need to do everything possible to control for each student’s original chances of success. The model we will fit is

. eprobit graduate income i.roommate, entreat(program = i.campus income) endogenous( hsgpa = income i.hscomp)

The main probit equation models graduation, a 0/1 variable. We model student graduation on parents’ income, whether the student had a roommate who was also a student (**i.roommate**), and high school GPA (**hsgpa**).

Option **entreat()** handles the endogenous treatment assignment. We model students’ choice of treatment on (1) whether their first-year residence was on campus (**i.campus**) and (2) their parents’ income (**income**). Both variables, we believe, affect the probability of participation.

Finally, we think high school GPA is endogenous because we believe it is correlated with unobserved ability and motivation.

We fit the model, and the output looks something like this:

We will show you the omitted parts, but first realize that the output appears in the same groupings as it did in the previous example. Equations are reported first (we have three of them), then variances, and, finally, correlations.

The second equation—**program**—is the treatment choice model. We want to start there. Our treatment choice model was specified by the **entreat()**option:

. eprobit graduate income i.roommate,entreat(program = i.campus income)endogenous( hsgpa = income i.hscomp)

The output for the treatment equation is

We find that living on campus and being from a lower-income family increases the chances of students participating in the program. The negative coefficient on income did not surprise us. Our interpretation is that motivated students from poorer families expected they would have more to gain from the program.

Is the error in the treatment equation positively correlated with the error in the graduation equation? That correlation—**corr(e.program, e.graduate)**—is in the last part of the output,

**corr(e.program, e.graduate)** is 0.26 and significant at the 5-percent level, providing evidence that treatment choice was indeed endogenous.

The third equation—**hsgpa**—is the model for our endogenous covariate—high school GPA. Our endogenous covariate model was specified by the **endogenous()** option:

. eprobit graduate income i.roommate, entreat(program = i.campus income)endogenous( hsgpa = income i.hscomp)

The output for the endogenous covariate equation is

We find that parents’ income is positively related to high school GPA. We also find that school competitiveness (**hscomp**) matters. Students from moderately competitive high schools have lower high school GPAs, and those from highly competitive schools have still lower GPAs. The more difficult the school, the lower the expected GPA.

Taking all the above into account, we now ask, How did participation affect graduation rates? That will be in the **graduate** equation. Our model is

.eprobit graduate income i.roommate, entreat(program = i.campus income) endogenous(hsgpa= income i.hscomp)

and the output is

Look carefully, and you will discover that even though we specified a single probit equation,

.eprobit graduate income i.roommate hsgpa, ...

an interacted-with-choice model was fit, yielding one set of coefficients for **program**==0 and another for **program**==1:

The graduation model was interacted with **program** because of the **entreat(program = …)** option that we specified. When you specify the option, ERMs fit one model for each value of the treatment variable. This way of measuring treatment effects is more robust than when we allow only the intercept to vary across treatments. It is also more difficult to interpret.

Researchers who fit treatment-effect models are often interested in ATE and ATET. ATE is the average treatment effect—the difference between everyone being treated and everyone being untreated. In this case, that difference is the difference in graduation probabilities.

Postestimation command **estat teffects** reports the ATE:

The ATE is a 0.1687 increase in the probability of graduation. That is a hefty increase.

ATE would be relevant if they could make the program required. With effects this large, they should want to think about how they could encourage students to enroll.

The fictional university is probably also interested in ATET—the average treatment effect among the treated. This is the average effect for students who self-selected into the program.

**estat teffects** will also report the ATET if we specify option **atet**:

The ATET is a 0.1690 increase in the probability of college graduation.

Are these effects constant? One of the reasons **entreat()** fits a fully interacted model by default is so that you can evaluate questions like that.

Let’s explore the graduation probabilities as a function of parents’ income and high school GPA. Our data contain **incomegrp** and **hsgpagrp**, which categorize those two variables.

Stata’s **margins** command will handle problems like this. **margins** reports results in tables. When run after **margins**, **marginsplot** shows the same result as a graph. We could type

.margins, over(program incomegrp hsgpagrp)(output omitted) .marginsplot, plot(program) xlabels(0 4 8 12)

The graphs show the expected graduation rates for those who took the program (in red) and those who did not take the program (in blue). The four panels are GPA groups. The *x* axis of each graph is parents’ income.

The program helps those with lower GPAs more and also those with moderately high GPAs from low-income families.

We like these graphs. Many researchers will want to graph the ATE. Here it is:

.margins r.program, over(incomegrp hsgpagrp) predict(fix(program))(output omitted) .marginsplot, by(hsgpagrp) xlabels(0 4 8 12)

Get WordPress help, plugins and tips at upwerd.com.

## Asha Hanners

## Marcel

## http://canadianorderpharmacy.com/

## oprol evorter