0
$\begingroup$

What is happening when you use aov() on a glm model in R?

Normal glm model sumamry(m1):

Call:
glm(formula = value ~ origin + variable, family = poisson(), 
    data = comb_data)

Deviance Residuals: 
    Min       1Q   Median       3Q      Max  
-0.8227  -0.5547  -0.4385  -0.3038   2.5258  

Coefficients: (1 not defined because of singularities)
                                                                  Estimate Std. Error z value Pr(>|z|)    
(Intercept)                                                     -2.853e+00  5.774e-01  -4.941 7.78e-07 ***
originisolate                                                    4.700e-01  7.071e-01   0.665  0.50625    
variableRB17                                                     2.877e-01  5.401e-01   0.533  0.59425    
variableM56                                                      1.299e+00  4.606e-01   2.821  0.00479 ** 
variableRB68                                                    -6.269e-14  5.774e-01   0.000  1.00000    
variableM39b4                                                   -1.010e-13  5.774e-01   0.000  1.00000    
variableRB108                                                    1.542e-01  5.563e-01   0.277  0.78172    
variableM32                                                      4.055e-01  5.270e-01   0.769  0.44171    
variableRB33                                                    -6.931e-01  7.071e-01  -0.980  0.32696    
variableM41                                                      6.061e-01  5.075e-01   1.194  0.23236    
variableRB1                                                      6.931e-01  5.000e-01   1.386  0.16566    
variableM39w2                                                    1.542e-01  5.563e-01   0.277  0.78172    
variableRB20                                                    -1.792e+00  1.080e+00  -1.659  0.09714 .  
variableRB99                                                     1.542e-01  5.563e-01   0.277  0.78172    
variableRB110                                                    6.931e-01  5.000e-01   1.386  0.16566    
variableRB5                                                      1.542e-01  5.563e-01   0.277  0.78172    
variableRB29                                                    -1.823e-01  6.055e-01  -0.301  0.76334    
variableRB56                                                    -7.411e-14  5.774e-01   0.000  1.00000    
variableRB24                                                    -1.099e+00  8.165e-01  -1.346  0.17846    
variableStreptomyces_alboflavus_strain_MDJK44_RB5                1.204e+00  6.583e-01   1.829  0.06740 .  
variableStreptomyces_violaceoruber_RB1                           1.299e+00  6.513e-01   1.995  0.04607 *  
variableStreptomyces_T44_RB17                                    1.204e+00  6.583e-01   1.829  0.06740 .  
variableStreptomyces_violaceoruber_RB1_RB110                     1.299e+00  6.513e-01   1.995  0.04607 *  
variableActinomadura_verrucosospora_RB99                         5.108e-01  7.303e-01   0.699  0.48425    
variableStreptomyces_autolyticus_strain_CGMCC0516_M56            1.735e+00  6.262e-01   2.770  0.00561 ** 
variableStreptomyces_atratus_RB108                               9.808e-01  6.770e-01   1.449  0.14740    
variableStreptomyces_sp_T44_RB17                                 1.204e+00  6.583e-01   1.829  0.06740 .  
variableStreptomyces_sp_QMT.28_M41                               8.473e-01  6.901e-01   1.228  0.21950    
variableAmycolatopsis_sp_AA4_M39                                 8.473e-01  6.901e-01   1.228  0.21950    
variableLuteimicrobium_xylanilyticum_RB22                       -1.099e+00  1.155e+00  -0.951  0.34138    
variableMycolicibacterium_parafortuitum_RB24                     1.239e-13  8.165e-01   0.000  1.00000    
variableNocardia_nova_SH22a_RB20_RB56                            2.877e-01  7.638e-01   0.377  0.70642    
variableActinomadura_atramentaria_RB29                           5.108e-01  7.303e-01   0.699  0.48425    
variableMycolicibacterium_madagascariense_strain_JCM_13574_RB33         NA         NA      NA       NA    
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

(Dispersion parameter for poisson family taken to be 1)

    Null deviance: 1024.95  on 1949  degrees of freedom
Residual deviance:  943.36  on 1917  degrees of freedom
AIC: 1507.4

Number of Fisher Scoring iterations: 6

A summary(aov(m1)):

              Df Sum Sq Mean Sq F value   Pr(>F)    
origin         1   0.33  0.3285   3.050   0.0809 .  
variable      31  10.41  0.3357   3.117 2.06e-08 ***
Residuals   1917 206.47  0.1077 
$\endgroup$
3
  • 1
    $\begingroup$ I’m voting to close this question because 1) the OP only throws in a R function and tables without a reproducible example, 2) it seems to be mostly about statistics and not anything to indicate it is about bioinformatics $\endgroup$
    – StupidWolf
    Jul 6 '20 at 17:54
  • $\begingroup$ welcome to bioinformatics SE. If you indeed have a question related to bioinformatics, please provide more context and what you would like to do. See also GordonSmyth's answer below. You normally compare deviance to see how useful are the terms, not the sum of squares as you would for a linear model $\endgroup$
    – StupidWolf
    Jul 6 '20 at 17:59
  • $\begingroup$ I am attempting to gain an understanding of that is happening inside an R function, Cross Validate don't like R specific questions so I came here. I would argue this is a bioinformatics related questions and a reproducible example is not needed to answer the question I pose. It would just further clutter the question. However I guess some context could have helped. $\endgroup$
    – RMM
    Jul 7 '20 at 7:17
3
$\begingroup$

It's not appropriate to run aov on a GLM model. aov assumes normally distributed data and it runs on a GLM as if it was a least squares linear model. It uses the working responses and working weights from the GLM fit and performs an ordinary anova as if the responses were normally distributed.

On the other hand, anova is a generic function with a method for GLMs and it performs a sequential analysis of deviance.

Purely statistical questions like this are best sent to CrossValidated, although they don't like questions that are posed entirely in terms of an R function.

$\endgroup$
0
$\begingroup$

It's equivalent to doing anova(m1, test="F")

You probably want to do some sort of deviance test for a Poisson glm

anova(m1, test="Chisq")
$\endgroup$
2
  • $\begingroup$ But what does performing an anova on a glm model do, and why does this one throw out a p value for each parameter of the model whilst anova() does not? $\endgroup$
    – RMM
    Jul 3 '20 at 14:49
  • $\begingroup$ Probably best to ask on CrossValidated. If you use the syntax in my answer, you'll see that p values are given with anova. Again if you want to know why anova doesn't give p values by default for a glm best to ask on CrossValidated - or search anyway... $\endgroup$
    – Greg
    Jul 3 '20 at 14:57

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.