Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down at the end of May, and its replacement, statalist.org is already up and running.


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: st: predict after logit


From   Sara Borelli <saraborelli77@gmail.com>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: predict after logit
Date   Thu, 12 Jul 2012 14:08:10 -0400

thank you Tim for the suggestion,
I cannot find the margins options...may it be because this is a new
feature of STATA ?
I am using stata 10
thanks
Sara


On Wed, Jul 11, 2012 at 5:27 PM, Tim Wade <wadetj@gmail.com> wrote:
> apologies,  the first segment of code  should read:
>
> sysuse auto.dta
> xtile hiprice=price, nq(2)
> logistic foreign hiprice mpg
> margins, by(hiprice)
>
>
> On Wed, Jul 11, 2012 at 5:26 PM, Tim Wade <wadetj@gmail.com> wrote:
>> If I understand what you are asking, I think margins does this:
>>
>> margins, by(hiprice)
>> sysuse auto.dta
>> xtile hiprice=price, nq(2)
>> logistic foreign hiprice mpg
>> margins, by(hiprice)
>>
>>
>> ------------------------------------------------------------------------------
>>              |            Delta-method
>>              |     Margin   Std. Err.      z    P>|z|     [95% Conf. Interval]
>> -------------+----------------------------------------------------------------
>>      hiprice |
>>           1  |   .2162162   .0557663     3.88   0.000     .1069163    .3255161
>>           2  |   .3783784   .0681487     5.55   0.000     .2448094    .5119474
>> ------------------------------------------------------------------------------
>>
>>
>> note this margin estimates are the same as the means of phat:
>>
>> logistic foreign hiprice mpg
>> predict phat
>> tabulate hiprice, summ(phat)
>>
>>
>> 2 quantiles |       Summary of Pr(foreign)
>>    of price |        Mean   Std. Dev.       Freq.
>> ------------+------------------------------------
>>           1 |   .21621622   .23645819          37
>>           2 |   .37837838   .25520846          37
>> ------------+------------------------------------
>>       Total |    .2972973   .25759862          74
>>
>> Tim
>>
>>
>> On Wed, Jul 11, 2012 at 1:01 PM, Sara Borelli <saraborelli77@gmail.com> wrote:
>>> Hi all,
>>> I am running a logit model to obtain a predicted probability for each
>>> individual (phat_i)  using predict, pr command .
>>>
>>>  I have to calculate the average of  this prediction within some
>>> categories of a variable x:
>>>  mean_phat_i=mean( phat_i)  by(x)
>>> and obtain standard errors and confidence interval for this mean.
>>>
>>> I know I can use adjust for this purpose, but I also need to calculate
>>> standard errors/confidence intervals  for mean_phat_i
>>>
>>> Thanks in advance for any insight
>>>
>>> Sara
>>> *
>>> *   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/
> *
> *   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/
*
*   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/


© Copyright 1996–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index