Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Re: st: Clarify, tfunc(exp)
From
Renzo Carriero <[email protected]>
To
[email protected]
Subject
Re: Re: st: Clarify, tfunc(exp)
Date
Tue, 17 Jan 2012 10:02:50 +0100
Dear Nick,
thanks for your answer and apologize for my late reply (there has been
some problem with my email server, so I am replying from another
address).
This is just to point out that:
1) I have already posted my request to a specific list devoted to
-clarify- without getting a reply (by the way, I am currently unable
to access this list)
2) Regarding the flag reporting E[exp()], my concern is that if this
were really the case I should get geometric predicted means as a
result of exponentiating predicted log means (this is actually what
Stata -adjust- does). I have the feeling that -simqi- back transforms
values so to get arithmetic mean on the original (unlogged) scale, but
I'm unable to understand how.
Renzo
>A much more positive comment is that your problem is one where I
>would try using -glm- to solve the answer directly. That is, using a
>log link function is likely to beat transforming and
>back-transforming. The two are not exactly equivalent but in my
>experience -glm- usually works as well or better and in any case there
>is flexibility about what error family you use.
>
>If -glm- works the whole business of using either -clarify- or
>-adjust- would be quite unnecessary.
>
>Nick
>
>On Fri, Jan 13, 2012 at 10:11 AM, Nick Cox <[email protected]> wrote:
> A reference missing here is http://gking.harvard.edu/clarify or
> http://www.stanford.edu/~tomz/software/software.shtml
>
> These references point to rather extensive documentation.
>
> I have never used -simqi- but the last fragment of output below does
> flag that -simqi- is reporting E[exp()] so why you are uncertain about
> that is unclear. As you know exp(E[]) will in general differ.
>
> I wouldn't expect authoritative support on -clarify- from this list,
> as people who understand this kind of thing and do it a lot (not me)
> appear to use Stata's official commands instead, while I don't think
> that the authors are members of this list.
>
> I suspect that you are best advised to write to the program authors
> directly, meaning I guess Michael Tomz, if this thread does not
> satisfy.
>
> Nick
>
>
> On Fri, Jan 13, 2012 at 8:36 AM, Renzo Carriero <[email protected]> wrote:
>> 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/