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: RE: Unordered Categorical Predictor Variable


From   louis grandjean <lgrandjean@gmail.com>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: RE: Unordered Categorical Predictor Variable
Date   Fri, 25 Jan 2013 10:09:24 -0500

Many many thanks for all your help so far.  I do still remain a little
confused however.

Elan's post estimation command test, tests one level against another
(perhaps it's possible to also use it to test one level against the
rest).

While Richard's idea if I'm interpreting it correctly does compare one
level to all the others but the regression needs to be repeated each
time to do it so the coefficients on the other predictor variables in
the model will change (albeit only slightly).

The biological question is: Is one bacterial species more
transmissible when compared to all the other species.  If that helps.
Deviation coding compares one species to the mean of everything
(including itself).

Perhaps there is a very simple explanation I've overlooked, or perhaps
I need to look harder at what's already been said - apologies if this
is the case.

On 25 January 2013 09:52, Richard Williams
<richardwilliams.ndu@gmail.com> wrote:
> At 09:15 AM 1/25/2013, Cohen, Elan wrote:
>>
>> Louis,
>>
>> You'll be interested in the postestimation command -test- and maybe
>> -margins-.  Also, you no longer need to use the -xi:- prefix.
>>
>> sysuse auto
>> reg price i.rep78
>> test 2.rep78=3.rep78
>>
>> HTH,
>>
>> - Elan
>
>
> This makes sense to me but I am not clear what Louis wants, since he keeps
> on talking about 1 category versus all the others, but he doesn't want to do
> one family vs the mean of the others. Is this what he wants?
>
> sysuse auto
> reg price i1.rep78
> reg price i2.rep78
> reg price i3.rep78
> reg price i4.rep78
> reg price i5.rep78
>
> I don't particularly like that since only one dummy is included at a time
> but it is one category vs all others. If Louis can get Stata 12, maybe the
> contrast command could give him what he wants.
>
>
>> -----Original Message-----
>> From: owner-statalist@hsphsun2.harvard.edu
>> [mailto:owner-statalist@hsphsun2.harvard.edu] On Behalf Of louis grandjean
>> Sent: Thursday, January 24, 2013 19:34
>> To: statalist@hsphsun2.harvard.edu
>> Subject: Re: st: RE: Unordered Categorical Predictor Variable
>>
>> Thanks Peter for your help.  I'm sure you're not missing the point.  I
>> may be however.  If I use the i.varname command with xi: then I will
>> get the odds ratio reported for one comparison of interest, i.e.
>> bacterial family 1 vs bacterial family 2,3 & 4 as the reference.  I
>> also want to know the odds ratio for bacterial family 2 vs 1,3 & 4.
>> Could I just run the regression again having changed the base
>> reference, or is there some way I can do it in the one command.
>>
>>
>>
>> On 24 January 2013 18:48, Lachenbruch, Peter
>> <Peter.Lachenbruch@oregonstate.edu> wrote:
>> > i may be missing the point here, but why cant you use the factor
>> > variable coding (i.varname)  you can vary the base variable.  See factor
>> > variable in manual.  comparing all possible factor codings doesn't make much
>> > sense since they will be dependent, and you can use contrasts for whatever
>> > you want.
>> >
>> > Peter A. Lachenbruch,
>> > Professor (retired)
>> > ________________________________________
>> > From: owner-statalist@hsphsun2.harvard.edu
>> > [owner-statalist@hsphsun2.harvard.edu] on behalf of louis grandjean
>> > [lgrandjean@gmail.com]
>> > Sent: Thursday, January 24, 2013 7:08 AM
>> > To: statalist@hsphsun2.harvard.edu
>> > Subject: st: Unordered Categorical Predictor Variable
>> >
>> > Dear Statalist,
>> >
>> > I'm using Stata 11 and am struggling with how to best analyse an
>> > unordered categorical predictor in a logistic regression.
>> >
>> > My categorical predictor is "bacterial family" so it doesn't make
>> > sense to always compare one family to an arbitrarily chosen reference
>> > family.  What I want to do is compare each family in turn to all the
>> > other families.
>> >
>> > I think deviation coding would give me one family vs the mean of all
>> > the families, but I want to get one family vs the other famlies, and
>> > obtain an odds ratio for each level.
>> >
>> > I've looked at xi3 but this doesn't seem to answer the problem.
>> >
>> > I'd be very grateful for your thoughts.
>> >
>> > Best wishes Louis
>> > *
>> > *   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/
>> > *
>> > *   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/
>>
>> *
>> *   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/
>>
>>
>> *
>> *   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/
>
>
> -------------------------------------------
> Richard Williams, Notre Dame Dept of Sociology
> OFFICE: (574)631-6668, (574)631-6463
> HOME:   (574)289-5227
> EMAIL:  Richard.A.Williams.5@ND.Edu
> WWW:    http://www.nd.edu/~rwilliam
>
>
> *
> *   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/
*
*   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