Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Adjusted odds ratios using the or_glm() function?

I’m using or_glm() to calculate odds ratios, using this reproducible example:

    library(oddsratio)
    or_glm(data = data_glm, 
           model = glm(admit ~ gre + gpa + rank, 
                       data = data_glm, 
                       family = "binomial"), 
           incr = list(gre = 1, gpa = 1, rank = 1))

I have two questions:

  1. How can I also extract a p-value for each odds ratio?
  2. How can I get an odds ratio for "gre" adjusted for for "gpa" and "rank"?

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

I would try as follows:

library(oddsratio)
library(mfx)

model = glm(admit ~ gre + gpa + rank, 
                   data = data_glm, 
                   family = "binomial")
logitor(admit ~ gre + gpa + rank,data=data_glm)
Call:
logitor(formula = admit ~ gre + gpa + rank, data = data_glm)

Odds Ratio:
      OddsRatio Std. Err.       z     P>|z|    
gre   1.0022670 0.0010965  2.0699 0.0384651 *  
gpa   2.2345448 0.7414651  2.4231 0.0153879 *  
rank2 0.5089310 0.1610714 -2.1342 0.0328288 *  
rank3 0.2617923 0.0903986 -3.8812 0.0001039 ***
rank4 0.2119375 0.0885542 -3.7131 0.0002047 ***
---
Signif. codes:  
0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

exp(coef(model))
(Intercept)         gre         gpa       rank2 
  0.0185001   1.0022670   2.2345448   0.5089310 
      rank3       rank4 
  0.2617923   0.2119375 

exp(cbind(OR=coef(model), confint(model)))
Waiting for profiling to be done...
                   OR       2.5 %    97.5 %
(Intercept) 0.0185001 0.001889165 0.1665354
gre         1.0022670 1.000137602 1.0044457
gpa         2.2345448 1.173858216 4.3238349
rank2       0.5089310 0.272289674 0.9448343
rank3       0.2617923 0.131641717 0.5115181
rank4       0.2119375 0.090715546 0.4706961
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading