Take the 2-minute tour ×
Cross Validated is a question and answer site for people interested in statistics, machine learning, data analysis, data mining, and data visualization. It's 100% free, no registration required.

I need to run a logistic regression with a binary response variable and a categorical explanatory variable.

My explanatory variable has 3 levels:

  • Forest
  • Plantation1
  • Plantation2

I would like to find a way to test the significance of all 3 possible contrasts:

  • Plantation1 vs. Forest
  • Plantation2 vs. Forest
  • Plantation1 vs. Plantation2

I have coded my categorical variable as 2 dummy variables (Plantation1 and Plantation2), using Forest as the "reference" group, which allows me to test the first 2 contrasts. If I recode the dummy variables using Plantation1 as the "reference" group, I can run the regression again and test the 1st and 3rd contrasts, giving me all the information I need.

Is this approach statistically "wrong"? If so, why?

UPDATE: Thanks to fg nu's answer, I have found a function in R that does multiple comparisons for main effects: the glht function in the multcomp package.

share|improve this question

1 Answer 1

You don't say what platform you are using. Stata makes this very easy to do using the margins, pwcompare command.

For example,

webuse nhanes2
logistic highbp sex##agegrp##c.bmi
margins agegrp, pwcompare

gives you the output,

. margins agegrp, pwcompare

Pairwise comparisons of predictive margins
Model VCE    : OIM

Expression   : Pr(highbp), predict()

--------------------------------------------------------------
             |            Delta-method         Unadjusted
             |   Contrast   Std. Err.     [95% Conf. Interval]
-------------+------------------------------------------------
      agegrp |
     2 vs 1  |   .0182344   .0069751      .0045635    .0319054
     3 vs 1  |     .08395   .0097271      .0648852    .1030148
     4 vs 1  |   .1443977   .0111944       .122457    .1663383
     5 vs 1  |   .1517272   .0082323      .1355922    .1678622
     6 vs 1  |   .1443064   .0126661      .1194813    .1691314
     3 vs 2  |   .0657156    .010205      .0457141    .0857171
     4 vs 2  |   .1261632   .0116121      .1034039    .1489225
     5 vs 2  |   .1334928   .0087919       .116261    .1507245
     6 vs 2  |   .1260719   .0130367      .1005205    .1516234
     4 vs 3  |   .0604477   .0134464      .0340932    .0868021
     5 vs 3  |   .0677772   .0111023       .046017    .0895374
     6 vs 3  |   .0603564   .0146942      .0315562    .0891565
     5 vs 4  |   .0073296    .012408     -.0169898    .0316489
     6 vs 4  |  -.0000913   .0157041     -.0308707    .0306882
     6 vs 5  |  -.0074208   .0137504     -.0343712    .0195295
--------------------------------------------------------------

which gives you the pairwise comparisons of the average predicted probability of high BP within each of the age groups defined by the agegrp variable.

share|improve this answer
    
Thanks for the response. I'm using R. If Stata has a nice command for all pairwise contrasts, does this mean it is perfectly acceptable from a statistical point of view? I'm trying to understand if I will be inflating alpha or causing some other problem if I do this. –  KTwildginger Nov 10 '12 at 20:32
    
@KTwildginger I am assuming you are worried about multiple comparison issues. I am going to say I don't know. Although, I am pretty sure you can get at all the contrasts using an appropriate Wald test and hence using one application of the Delta method, so multiple comparison issues should not apply. –  fg nu Nov 12 '12 at 13:46

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.