1

I am running my glm and trying to get one p-value pr variable. Some of the variables ends up having 3 p-values. I would like to get out one variable for anesthesia and not 3 different according to the different kinds of anesthesia. Is that possible?

Call:

glm(formula = smerte ~ Sex + Anesthesia + S + adgang + group_code, 
    family = binomial, data = severepain)

Deviance Residuals: 
    Min       1Q   Median       3Q      Max  
-1.9146  -1.1863   0.6822   0.7572   1.4880  

Coefficients:
                                          Estimate Std. Error z value Pr(>|z|)    
(Intercept)                               -0.17102    0.95092  -0.180 0.857271    
Sexmale                                    0.23684    0.20857   1.136 0.256154    
AnesthesiaGeneral anesthesia               0.95036    0.48247   1.970 0.048861 *  
AnesthesiaSpinal anesthesia                0.84572    0.47893   1.766 0.077419 .  
AnesthesiaSpinal anesthesia with sedation  0.84671    0.44777   1.891 0.058634 .  
Shybrid                                   -0.33517    0.86720  -0.386 0.699131    
Suncemented                               -0.21536    0.79579  -0.271 0.786679    
adgangposterior_ad                         0.88191    0.25030   3.523 0.000426 ***
group_code                                -0.07988    0.09034  -0.884 0.376600    
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

(Dispersion parameter for binomial family taken to be 1)

    Null deviance: 616.68  on 530  degrees of freedom
Residual deviance: 592.16  on 522  degrees of freedom
AIC: 610.16

Number of Fisher Scoring iterations: 4
Ferdi
  • 4,882
  • 7
  • 42
  • 62

2 Answers2

4

You are looking for a likelihood ratio test. You can do this by fitting two models, one with anesthesia included and one without it but both models including all the other variables. You then compare these two models. In R you can use the anova() function for this. If you want to do this for all the categorical variables which you have (anesthesia and S) then there is a command for that drop1().

Note that questions specifically about how to do X in R are best asked on R-help but you do have a statistical issue here about the LRT.

mdewey
  • 16,541
  • 22
  • 30
  • 57
0

This is called a chunk test.

You would make some full_model that includes all of the types of anesthesia, plus whatever other variables you want to include (could be none, but it looks like you have some). Then you would make some reduced_model that includes those other variables but not the any of the anesthesia variables. Finally, you compare the nested models, such as by lmtest::lrtest(full_model, reduced_model) to do a likelihood ratio test (preferred to lmtest::waldtest(full_model, reduced_model) to do a Wald test).

This is what's going on in the regular ANOVA F-test. In that test, we have two models, one including the groups and another considering all observations to come from the same group. We then do a Wald test of the nested models. Chunk tests extend this idea.

In R, it looks like you would do the following.

full_model <- glm(formula = smerte ~ Sex + Anesthesia + S + adgang + group_code, 
    family = binomial, data = severepain)
reduced_model <- glm(formula = smerte ~ Sex + S + adgang + group_code, 
    family = binomial, data = severepain)
lmtest::lrtest(full_model, reduced_model)
Dave
  • 28,473
  • 4
  • 52
  • 104