Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: estout and likelihood ratio test


From   "Ben Jann" <ben.jann@gmail.com>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: estout and likelihood ratio test
Date   Fri, 26 Oct 2007 23:20:19 +0200

Raoul, simply type

. estadd scalar p_trend = r(p) : model1

ben

On 10/25/07, Raoul C Reulen <r.c.reulen@bham.ac.uk> wrote:
> Dear Statalisters,
>
> I'm running a glm model and like to do a a likelihood ratio test. However, the likelihood ratio test is based
> on a slightly different model. I have difficulty getting the likelihood ratio estimates in a table that I created
> with estout. See output below
>
> //first I ran the regression model
>
> .xi: glm _d i.CE , fam(pois) lnoffset(E) eform
>
> // Then I used estout to save the regression estimates, confidence intervals, and p-values in a table
>
> .est store model1
> .estout model1, cells("b (fmt(%9.2f))ci(par( ( , ) )) p(fmt(%9.4f))") eform
>
>
> //Then I did a likelihood ratio test on a slightly different model:
>
> .xi: glm _d CE , fam(pois) lnoffset(E) eform
> .est store model2
> .xi: glm _d if CE!=. , fam(pois) lnoffset(E) eform
> .est store model3
> .lrtest  model2 model3
>
> //I saved the p-value for the likelihood ratio test:
>
> .estadd scalar p_trend = r(p)
>
>
> Is there a way to append the stored value to the estout output based on model 1?
> I have tried the following
> .estout model1 model2, cells("b (fmt(%9.2f))ci(par( ( , ) )) p(fmt(%9.4f))") eform stats(p_trend)
>
> but this puts the p_trend value in a seperate column, which is not suprising because it is actually part of model 2.
>
> I have also tried to save the estimates of the first model and then append the p_trend value for the second model, but I think estout cannot just append the p_trend because it will need to store at least some of the estimates of the second model. See below:
>
> .estout model1, cells("b (fmt(%9.2f))ci(par( ( , ) )) p(fmt(%9.4f))") eform stats(p_trend)
> .estout model2, cells("b (fmt(%9.2f))ci(par( ( , ) )) p(fmt(%9.4f))") stats(p_trend) append
>
> Hope it's clear
> Thanks
> Raoul
>
> Raoul Reulen
> Cancer Research UK Graduate Training Fellow
>
>
> *
> *   For searches and help try:
> *   http://www.stata.com/support/faqs/res/findit.html
> *   http://www.stata.com/support/statalist/faq
> *   http://www.ats.ucla.edu/stat/stata/
>
*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   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   |   What's new   |   Site index