 Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.

# st: RE: Calculating elasticities of an endogenous covariate with interaction terms

 From Eilya Torshizian To "'statalist@hsphsun2.harvard.edu'" Subject st: RE: Calculating elasticities of an endogenous covariate with interaction terms Date Tue, 1 Oct 2013 20:50:36 +0000

```Hi Jason,

To my understanding you have only X1 as the endogenous variable. If so, I would suggest to do the 2SLS by running the first stage as,

- regress X1 Z

Then predict the X1 values,

- predict X1_hat

In the next step you can use the predicted X1 as an explanatory variable in your second stage and then use the margins command,

- regress depvar X1##X2 X2##X2 X1##X2
- margins, dydx()

Also you can do this by using the ivreg command.

Kind regards,
Eilya.

-----Original Message-----
From: owner-statalist@hsphsun2.harvard.edu [mailto:owner-statalist@hsphsun2.harvard.edu] On Behalf Of Jason Russ
Sent: Wednesday, 2 October 2013 7:28 a.m.
To: statalist
Subject: st: Calculating elasticities of an endogenous covariate with interaction terms

Hi Statalisters,

I have a question regarding calculating elasticities when there are endogenous covariates.

I am estimating a translog production function in which the covariate of interest is endogenous. There are three regressors, X1, X2, and X3, (all in log form) and X1 is endogenous. Following the translog form, all squared terms and interaction terms are also included (using stata's syntax of c.X1##c.X1 c.X2##c.X2 c.X1#c.X2 etc...).

After estimating the regression, I need to calculate the elasticity of X1. If X1 were not endogenous, I would use the following function to estimate elasticity:

margins, dydx(X1) atmeans

However, since X1 is endogenous, I am running 2sls with the instrument Z, using "ivregress". Because of the translog form, all of the interaction terms which include X1 are also instrumented by replacing the X1 part of the interaction term with Z. That means there will be 4 "stage 1", reduced form regressions (one for each of the endogenous variables X1, X1^2, X1*X2, X1*X3)

Here's my problem: when using ivregress, stata will not let me include an interaction term as the dependent variable of the reduced form regression. I get the error  "depvars may not be interactions".

One alternative is to simply define a new variable for the squared and interaction terms, rather than using stata syntax with the hashtags.
However, then I could not use the "margins" function, and would need to calculate the elasticities by hand, which is feasible, but very time consuming. However, it would also mean calculating the standard errors of the elasticities by hand, the method for which is not obvious to me (do I need to bootstrap?).

I would greatly appreciate it if anyone could alert me to a built in Stata function (if one exists) that allows interaction variables as dependent variables of the reduced form of a 2-stage regression.

If a function does not exist, any advice on how to efficiently calculate the standard errors would also be very helpful and appreciated. Would bootstrapping be the only way to go?

Many thanks,
Jason Russ
*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/faqs/resources/statalist-faq/
*   http://www.ats.ucla.edu/stat/stata/

*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/faqs/resources/statalist-faq/
*   http://www.ats.ucla.edu/stat/stata/
```