Bookmark and Share

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: st: Median and CI with predict


From   Nick Cox <[email protected]>
To   "[email protected]" <[email protected]>
Subject   Re: st: Median and CI with predict
Date   Tue, 11 Feb 2014 12:27:48 +0000

Once you have covariates (predictors), a confidence interval for the
constant in -glm- cannot give you a confidence interval for the mean,
which is now a function of the predictors. Conversely, -ci- pays no
attention to predictors, which may or may not be a problem for you.

It is not clear whether you understand this, but I can't advise
further because I don't follow what you are doing.

Nick
[email protected]


On 11 February 2014 10:45, Carla Guerriero <[email protected]> wrote:
> Sorry I will try to be more clear:
> In my previous question I was asking about obtaining confidence
> interval for my dependent variable (willigness to pay) wich in my case
> is bounded between 0 and 1. After trying different models (zero
> inflated beta and beta) I fund that glm with logit  link function and
> binomial family works better (test with AIC and BIC) . I previously
> asked how to get the confidence intervals from constant only model and
> I was (wrongly) using the predict command.
> You suggested to run the regression and then to obtain the proportion
> to use "meta: invlogit (constant, lower an upper confidece interval
> values)" ..
> In order to obtain the confidence interval for my dependent variable
> you suggested to use the command: ci . I used "ci depvar,  jeffreys
> binomial" (I also tried Wilson"  but the command show a blank results
> (results with no number).. and I dont understand why.
> My further question was: is there a test I can perform in stata to
> test if the results from two different regressions are the same?
> for  example I have the willigness to pay for 1 in 100 risk reduciton
> is equal to 0.21 and the willigness to pay for 19 in 100 is 0.50 I
> want to test they are statisitcally different I can I do ?
> Hope this makes sense ..
> Kind Regards
> Carla
>
> On Tue, Feb 11, 2014 at 11:24 AM, Nick Cox <[email protected]> wrote:
>> Sorry, but I don't understand almost any of this.
>>
>> meta:  ?
>>
>> ic ?
>>
>> wtp ? WTP? (I think that means "willingness to pay", but please note
>> that only some people here are economists)
>>
>> Note that -ci- is limited to single variables and that its -wilson-
>> and -jeffreys- options don't travel to other commands.
>>
>> Whatever you did sounds at some considerable distance from your last
>> question and my last answer. If someone else can't work out what you
>> are saying, please read the FAQ advice again and give much more detail
>> on your problem.
>> Nick
>> [email protected]
>>
>>
>> On 11 February 2014 10:18, Carla Guerriero <[email protected]> wrote:
>>> Hi Nick
>>> I used your coding meta:... and the proportion come out ..
>>> I eventually apply  the ic command to my wtp dependent variable and it
>>> runs without error  but the output is blank ..with both the approaches
>>> ..(Wilson and Jeffreys)
>>> also another quesiton I need to test that the WTP values for different
>>> health risk redcution are the same or they statistically different ..
>>> usually I do the test command on coefficient but in this case I need
>>> to compare the values the come from different regression with
>>> intercpet only model .. there is a way to do that in stata ?
>>> Kind Regards
>>> Carla
>>>
>>> On Fri, Feb 7, 2014 at 5:00 PM, Carla Guerriero
>>> <[email protected]> wrote:
>>>> Thank you so much Nick that's great!!!
>>>> Kind  Regards
>>>> Carla Guerriero
>>>>
>>>> On Fri, Feb 7, 2014 at 4:56 PM, Nick Cox <[email protected]> wrote:
>>>>> I'd apply -ci- directly; indeed you have a choice of ways to do it.
>>>>>
>>>>> But as for -glm-, my answer is the same answer as before:
>>>>>
>>>>> 1. -glm- gives you confidence intervals in its main output. The only
>>>>> indirectness is that you need to invert the link.
>>>>>
>>>>> 2. -predict- is not needed.
>>>>>
>>>>> Examples:
>>>>>
>>>>> . sysuse auto
>>>>> (1978 Automobile Data)
>>>>>
>>>>> . glm foreign, link(logit)
>>>>>
>>>>> Iteration 0:   log likelihood = -53.942063
>>>>> Iteration 1:   log likelihood = -47.679133
>>>>> Iteration 2:   log likelihood = -47.065235
>>>>> Iteration 3:   log likelihood = -47.065223
>>>>> Iteration 4:   log likelihood = -47.065223
>>>>>
>>>>> Generalized linear models                          No. of obs      =        74
>>>>> Optimization     : ML                              Residual df     =        73
>>>>>                                                    Scale parameter =  .2117734
>>>>> Deviance         =  15.45945946                    (1/df) Deviance =  .2117734
>>>>> Pearson          =  15.45945946                    (1/df) Pearson  =  .2117734
>>>>>
>>>>> Variance function: V(u) = 1                        [Gaussian]
>>>>> Link function    : g(u) = ln(u/(1-u))              [Logit]
>>>>>
>>>>>                                                    AIC             =   1.29906
>>>>> Log likelihood   = -47.06522292                    BIC             = -298.7373
>>>>>
>>>>> ------------------------------------------------------------------------------
>>>>>              |                 OIM
>>>>>      foreign |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
>>>>> -------------+----------------------------------------------------------------
>>>>>        _cons |  -.8602013   .2560692    -3.36   0.001    -1.362088   -.3583149
>>>>> ------------------------------------------------------------------------------
>>>>>
>>>>> . mata: invlogit((-.8602013, -1.362088, -.3583149))
>>>>>                  1             2             3
>>>>>     +-------------------------------------------+
>>>>>   1 |    .29729729   .2039011571   .4113675423  |
>>>>>     +-------------------------------------------+
>>>>>
>>>>> . ci foreign, jeffreys binomial
>>>>>
>>>>>                                                          ----- Jeffreys -----
>>>>>     Variable |        Obs        Mean    Std. Err.       [95% Conf. Interval]
>>>>> -------------+---------------------------------------------------------------
>>>>>      foreign |         74    .2972973    .0531331        .2024107    .4076909
>>>>>
>>>>> . ci foreign, wilson binomial
>>>>>
>>>>>                                                          ------ Wilson ------
>>>>>     Variable |        Obs        Mean    Std. Err.       [95% Conf. Interval]
>>>>> -------------+---------------------------------------------------------------
>>>>>      foreign |         74    .2972973    .0531331        .2052722    .4093291
>>>>>
>>>>>
>>>>> Nick
>>>>> [email protected]
>>>>>
>>>>>
>>>>> On 7 February 2014 15:45, Carla Guerriero <[email protected]> wrote:
>>>>>> Hi Nick my dependent variable is a proportion (of the budget that
>>>>>> given a budget constraint individuals are willing to give up)
>>>>>> so I used  logit link function to ensure linearity and binomial family
>>>>>> distribution.. For example for 19 in 100 risk reduction I get a
>>>>>> coefficent of -.657211*** and If i use predict the mean WTP is 0.20
>>>>>> which makes sense .. but the SD is 0 .. I want to get CI for the mean
>>>>>> .. maybe boostrapping is an option? I know how to do for DCE where you
>>>>>> have a ratio of the coefficent (delta or boostrapping or parametric
>>>>>> boostrapping) but I have no clue how to make CI for eman WTP estimate
>>>>>> from regression ..
>>>>>>
>>>>>>
>>>>>> On Fri, Feb 7, 2014 at 4:26 PM, Nick Cox <[email protected]> wrote:
>>>>>>> -glm- with no covariates gives you confidence intervals for mean
>>>>>>> response, directly or indirectly, depending on the link. No need to
>>>>>>> use -predict- at all. I don't think you can get confidence  intervals
>>>>>>> for the median that way.
*
*   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/


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index