1
$\begingroup$

I was analyzing the different treatments applied to products. It started out with a a plethora of variables but I came to the conclusion that I can essentially only control the treatment applied so I only wanted to calculate those odds and dropped all other variables that I cannot control.

Status = c('Fail','Pass','Pass','Fail','Fail','Fail','Fail','Fail','Fail','Fail','Fail','Fail','Pass','Fail','Pass','Pass','Fail','Fail','Fail','Fail','Fail','Fail','Pass','Fail','Pass','Fail','Fail','Fail','Fail','Fail','Pass','Fail','Pass','Pass','Pass','Pass','Pass','Pass','Pass','Pass')
Treatment = c('B','C','B','B','B','B','B','B','B','B','B','Z','B','B','B','B','B','C','C','B','B','B','B','B','B','B','C','C','C','C','Z','Z','Z','Z','Z','Z','Z','Z','Z','Z')

length(X)
length(D)
df = cbind(Status,Treatment)
df = as.data.frame(df)
xtabs(~Status + Treatment,data = df)
mylogit <- glm(Status ~ Treatment, data = df,family = "binomial")
exp(cbind(OR = coef(mylogit), confint(mylogit)))

I want to make sure that I am interpreting the results correctly.

Treatment Z increases the odds of Pass by 1200%

Treatment C increases the odds of Pass by a factor 0f 44%

Also, where do I get the odds for Treatment B?

$\endgroup$

1 Answer 1

1
$\begingroup$

The code you provided estimates the logit with an intercept, so that's why Treatment B is not appearing. Otherwise, you would have a perfect multicollinearity problem and the coefficients would not be interpretable. The coefficient on Z is the unit increase in log odds over Treatment B, the coefficient on C is the unit increase in log odds over Treatment B, and the intercept coefficient is the log odds of Treatment B. For reference, this is the output from the R code in the question:

                    OR      2.5 %     97.5 %
(Intercept)  0.3750000 0.13454740  0.9119271
TreatmentC   0.4444444 0.02120948  3.4397196
TreatmentZ  12.0000000 2.30808827 95.7410385

So:

  1. The odds of pass for Treatment B is $0.375$.
  2. The odds of pass for Treatment C are 0.444 times the odds for Treatment B, so $0.375 \times 0.444 = 0.167$.
  3. The odds of pass for Treatment Z are 12.00 times the odds for Treatment B, so $0.375 \times 12.00 = 4.50$.

If you exclude the intercept from the logit estimation (which you do by appending -1 to the formula in R, if you didn't know already), you will actually see the results I calculated above directly.

> mylogit_no_intercept <- glm(Status ~ Treatment-1, data = df,family = "binomial")
> exp(coef(mylogit_no_intercept))
TreatmentB TreatmentC TreatmentZ 
 0.3750000  0.1666667  4.5000000 
$\endgroup$
4
  • $\begingroup$ No, odds are not probabilities so you don't use the % sign when discussing odds and you never multiply odds by 100. $\endgroup$ Commented Sep 19, 2014 at 13:24
  • $\begingroup$ @FrankHarrell Thanks for pointing that out. I didn't notice that the percent could be misinterpreted as probabilities. I've edited my answer to convert the percents back to decimals. $\endgroup$ Commented Sep 19, 2014 at 13:33
  • $\begingroup$ @FrankHarrell when reporting this I can say treatment Z odds for success are 12 times greater than treatment B and treatment C will yield roughly half the odds for success as treatment B. $\endgroup$ Commented Sep 19, 2014 at 15:54
  • $\begingroup$ Yes, and include confidence intervals in those statements. $\endgroup$ Commented Sep 19, 2014 at 16:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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