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 on April 23, and its replacement, statalist.org is already up and running.


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

Re: st: How to Compare the Coefficients of Specific Variable where Each Group is Estimated Separately


From   Yuval Arbel <yuval.arbel@gmail.com>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: How to Compare the Coefficients of Specific Variable where Each Group is Estimated Separately
Date   Wed, 19 Dec 2012 13:42:25 +0200

Maarteen, thank you very much. Indeed, I tried this method.
Apparently, my mistake was that I did not put -strata-, and therefore
I got different coefficients from those obtained when I ran each group
separately.

On Wed, Dec 19, 2012 at 12:14 PM, Maarten Buis <maartenlbuis@gmail.com> wrote:
> On Wed, Dec 19, 2012 at 7:16 AM, Yuval Arbel wrote:
>> I am running a -stcox- model on two groups, where my particular
>> interest is to compare the coefficients of the variable red_runmax1
>>
>> The difference between the two coefficients is -0.0246686 and I would
>> like to show that this difference is significant
>>
>> Finally I tried to run the test on a model with interactions with the
>> dummy. The problem is that I don't get the estimated -0.0246686
>> difference of coefficients.
>
> In order to reproduce the results from two separate -stcox- models,
> you also need to make sure that the baseline hazard rate is also
> different between the two groups. You can do so by adding the
> -strata()- option. See the example below:
>
> *----------------------------- begin example ------------------------------
> use http://www.stata-press.com/data/r12/stan3.dta, clear
> // estimate both model separately
> bys surgery: stcox age year, nohr
>
> // create interaction terms
> // use tricks from <http://www.maartenbuis.nl/publications/ref_cat.html>
> // to directly display the coefficients from the separate models, you
> // can see they are exactly the same
> gen surgXage = surgery*age
> gen surgXyear = surgery*year
> gen nonsurgXage = (surgery==0)*age if surgery < .
> gen nonsurgXyear = (surgery==0)*year if surgery < .
>
> stcox nonsurgXage nonsurgXyear surgXage surgXyear, strata(surgery) nohr
>
> // test whether the effect of year is the same in two groups
> test nonsurgXyear = surgXyear
> // see the chi^2 statistic and p-value with more digits for later comparison
> return list
>
> // the same model, but now you can read the test statistic
> // directly from the output.
> // Notice, I did not include the main effect of surgery, this
> // is implicitly added by the -strate()- option.
> stcox age year surgXage surgXyear, strata(surgery) nohr
> // see the chi^2 statistic and p-value with more digits
> // they are exactly the same as in the model above
> di "the chi^2 value is: " (_b[surgXyear]/_se[surgXyear])^2
> di "the p-value is: " 2*normal(-abs(_b[surgXyear]/_se[surgXyear]))
> *----------------------------- begin example ------------------------------
> (For more on examples I sent to the Statalist see:
> http://www.maartenbuis.nl/example_faq )
>
> Hope this helps,
> Maarten
>
> ---------------------------------
> Maarten L. Buis
> WZB
> Reichpietschufer 50
> 10785 Berlin
> Germany
>
> http://www.maartenbuis.nl
> ---------------------------------
> *
> *   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/



-- 
Dr. Yuval Arbel
School of Business
Carmel Academic Center
4 Shaar Palmer Street,
Haifa 33031, Israel
e-mail1: yuval.arbel@carmel.ac.il
e-mail2: yuval.arbel@gmail.com
*
*   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–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index