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

# st: Clarify, tfunc(exp)

 From Renzo Carriero To statalist@hsphsun2.harvard.edu Subject st: Clarify, tfunc(exp) Date Fri, 13 Jan 2012 09:36:25 +0100

```Dear Statalist users,

```
I have a question about the tfunc(exp) option of simqi command in King's et al. Clarify command suite. I can't understand how this option exactly compute exponentiated expected value. My depvar is a log ratio, say y=ln(a/b). My linear regression model contains a 4-category nominal variable (indicated by 3 dummies) plus covariates. When I compute mean predicted values on the log scale, results yielded by simqi coincide with those yielded by Stata's command adjust. On the contrary, when I ask for expected values in the original scale, that is exp(y), they markedly differ. It seems that Stata (adjust command with the "exp" option) exponentiates the mean expected value, such as exp[E(y|x)], while simqi does not. So what is exactly the way in which simqi transforms expected values in the original scale? To help, I add below a simplified example of what I mean using Stata's auto dataset
```
Many thanks
Renzo

--
Renzo Carriero
Dipartimento di Scienze Sociali
via S. Ottavio 50
10124 Torino - Italy
+390116702658 (office)
+393898160069 (mobile)
+390116702612 (fax)

sysuse auto.dta
g lny=ln(price/mpg)/*generate a log var similar to mine*/
```
xtile x=length, nquantile(4) /*generate a 4 category variable from length variable"
```tab x, gen(x)/*generate 4 dummies*/
reg lny x2-x4/*x1 is omitted as reference  category*/

```
Source | SS df MS Number of obs = 74 -------------+------------------------------ F( 3, 70) = 18,48 Model | 10,7554461 3 3,58514872 Prob> F = 0,0000 Residual | 13,580584 70 ,194008343 R-squared = 0,4420 -------------+------------------------------ Adj R-squared = 0,4180 Total | 24,3360302 73 ,333370277 Root MSE = ,44046
```
```
------------------------------------------------------------------------------ lny | Coef. Std. Err. t P>|t| [95% Conf. Interval] -------------+---------------------------------------------------------------- x2 | ,576453 ,1461643 3,94 0,000 ,2849374 ,8679685 x3 | ,635685 ,1376187 4,62 0,000 ,3612132 ,9101569 x4 | 1,050355 ,1437037 7,31 0,000 ,7637466 1,336962 _cons | 5,078354 ,0961171 52,84 0,000 4,886655 5,270054 ------------------------------------------------------------------------------
```
adjust x2=0 x3=0 x4=0 /*compute expected value for omitted category 1*/

Dependent variable: lny     Command: regress
Covariates set to value: x2 = 0, x3 = 0, x4 = 0
```
------------------------------------------------------------------------------------------------------
```
----------------------
All |         xb
----------+-----------
|    5,07835
----------------------
Key:  xb  =  Linear Prediction

```
adjust x2=0 x3=0 x4=0 , exp /*compute expected value for category 1 in the original scale (price/mpg)*/
```
Dependent variable: lny     Command: regress
Covariates set to value: x2 = 0, x3 = 0, x4 = 0
```
------------------------------------------------------------------------------------------------------
```
----------------------
All |    exp(xb)
----------+-----------
| *160,51 *
----------------------
Key:  exp(xb)  =  exp(xb)

estsimp reg lny x2-x4/*replicate analysis with estsimp*/
setx 0 /*set x1=1*/
simqi
```
*this output omitted, it is roughly equal to that of adjust without exp option
```simqi, tfunc(exp)

```
Quantity of Interest | Mean Std. Err. [95% Conf. Interval] ---------------------------+--------------------------------------------------
```               E[exp(lny)] | *177,6523 *17,95269     145,2497     215,657

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