1
$\begingroup$

I have some toy data for an experiment where subjects are shown pictures A,B and C and then they are given a choice between choice A or choice B. I am interested in determining the effect of the pictures on the response.

I am running a logistic regression to see how the pictures increase or decrease the liklihood of choose A or B. Here choosing A is coded 1 and choosing B is coded 0.

Here is some toy data for 100 subjects and the output of the logistic regression:

  > set.seed(666)
>  choice = sample(c(1,0),100, TRUE)
>  sex = sample(c("M","F"),100,TRUE)
>  picture = sample(c("A","B","C"),100,TRUE)
>  data = data.frame(choice = choice, sex = sex, picture = picture)
>   s=summary(glm(data = data, choice ~ factor(sex) + factor(picture), family = binomial(link = logit) ))
>   s

Call:
glm(formula = choice ~ factor(sex) + factor(picture), family = binomial(link = logit), 
    data = data)

Deviance Residuals: 
    Min       1Q   Median       3Q      Max  
-1.2957  -1.1216  -0.8907   1.1685   1.4943  

Coefficients:
                 Estimate Std. Error z value Pr(>|z|)  
(Intercept)        0.1200     0.4133   0.290   0.7716  
factor(sex)M       0.1539     0.4186   0.368   0.7132  
factor(picture)B  -0.2527     0.5191  -0.487   0.6264  
factor(picture)C  -0.8399     0.4962  -1.693   0.0905 .
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

(Dispersion parameter for binomial family taken to be 1)

    Null deviance: 137.63  on 99  degrees of freedom
Residual deviance: 134.51  on 96  degrees of freedom
AIC: 142.51

Number of Fisher Scoring iterations: 4

>   c = coef(s)
>   log_odds_ratio = c[,c("Estimate")] # log odds ratio
>   log_odds_ratio
     (Intercept)     factor(sex)M factor(picture)B factor(picture)C 
       0.1199990        0.1538543       -0.2527420       -0.8398664 
>   odds_ratio = exp(log_odds_ratio)
>   odds_ratio
     (Intercept)     factor(sex)M factor(picture)B factor(picture)C 
       1.1274957        1.1663209        0.7766682        0.4317682 
>   probability = odds_ratio/(1+odds_ratio)
>   probability
     (Intercept)     factor(sex)M factor(picture)B factor(picture)C 
       0.5299638        0.5383879        0.4371487        0.3015629 

The coefficients reported are in log odds so I take the exponential of the coef vector to make the odds_ratio vector.

My question is on interpretation of the picture B and picture C odds ratios:

0.7766682 0.4317682

I am interpreting 0.7766682 that seeing picture B will increase the odds ratio of choosing A (i.e. response=1) 0.7766682 MORE than picture A. Is that correct?

I then calculate the probabilities using the odds ratios above.

probability
     (Intercept)     factor(sex)M factor(picture)B factor(picture)C 
       0.5299638        0.5383879        0.4371487        0.3015629 

How should one interpret these probabilities? Picture B has a .437 probability of what?

Finally, how would you graphically show the different effects of the 3 pictures so interpretation can be understood for a non-statistician audience?

Would you plot the regression lines?Using log odds Betas or exp(Betas)? If so can you give an example plot?

Thank you very much

$\endgroup$
3
  • 1
    $\begingroup$ You need the to give glm the argument family = binomial(link = logit) to get logistic regression. The default is linear regression. $\endgroup$ Jul 10 '17 at 2:52
  • $\begingroup$ ah forgot to add that. updated $\endgroup$ Jul 10 '17 at 15:21
  • $\begingroup$ Perhaps this Q&A stats.stackexchange.com/questions/136193/… would be illuminating? $\endgroup$
    – mdewey
    Jul 10 '17 at 15:59
2
$\begingroup$

The Number of the Beast is an, um, interesting choice of seed.

I am interpreting 0.7766682 that seeing picture B will increase the odds ratio of choosing A (i.e. response=1) 0.7766682 MORE than picture A. Is that correct?

No. This is how you would interpret log odds ratios, but you antilogged those to get odds ratios, so the effect is multiplicative rather than additive. The odds ratio 0.78 means that the odds of giving response 1 when seeing picture B are 0.78 times the odds of giving response 1 when seeing picture A. For example, if a person seeing picture A had a .50 probability of giving response 1, then switching them to picture B would reduce the probability to .44 (using the formula $\frac{op}{1 + p(o - 1)}$ for the effect of an odds ratio $o$ on a probability $p$).

Your "probabilities" don't make sense. An odds ratio or log odds ratio shows a relationship between odds, or equivalently, a relationship between probabilities. It is not itself a probability.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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