<p>It's equivalent to doing <code>anova(m1, test=&quot;F&quot;)</code></p>
<p>You probably want to do some sort of deviance test for a Poisson glm</p>
<pre><code>anova(m1, test=&quot;Chisq&quot;)
</code></pre>

CC BY-SA 4.0
2020-07-03T14:49:36.230Z
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?
Lamma
CC BY-SA 4.0
2020-07-03T14:57:47.577Z
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...
Greg
CC BY-SA 4.0
2020-07-03T14:34:14.690Z
2020-07-03T14:34:14.690Z
Greg
<p>It's not appropriate to run <code>aov</code> on a GLM model. <code>aov</code> 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.</p>
<p>On the other hand, <code>anova</code> is a generic function with a method for GLMs and it performs a sequential analysis of deviance.</p>
<p>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. Questions purely about the functionality of functions in the core distribution of R are best sent to R-help, which is a mailing list rather than web forum (see <a href="https://www.r-project.org/mail.html" rel="nofollow noreferrer">https://www.r-project.org/mail.html</a> and <a href="https://stat.ethz.ch/mailman/listinfo/r-help" rel="nofollow noreferrer">https://stat.ethz.ch/mailman/listinfo/r-help</a>).</p>

CC BY-SA 4.0
2020-07-05T10:37:58.103Z
2021-12-24T01:34:41.273Z
2021-12-24T01:34:41.273Z
Gordon Smyth
<p>What is happening when you use <code>aov()</code> on a glm model in R?</p>
<p>Normal glm model <code>sumamry(m1)</code>:</p>
<pre><code>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(&gt;|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
</code></pre>
<p>A <code>summary(aov(m1))</code>:</p>
<pre><code>              Df Sum Sq Mean Sq F value   Pr(&gt;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 
</code></pre>

CC BY-SA 4.0
2020-07-06T17:54:22.713Z
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
StupidWolf
CC BY-SA 4.0
2020-07-06T17:59:16.340Z
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
StupidWolf
CC BY-SA 4.0
2020-07-07T07:17:06.263Z
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.
Lamma
<r>
What does aov(glm model) actually do in R?
# What does aov(glm model) actually do in R?

(Asked by: username_0 on 2020-07-03)

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

**Tags:** r
> **Comments:**
> **username_1**: 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  
> **username_1**: 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  
> **username_0**: 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.  

---

## 2 answers

### Answer by username_3 on 2020-07-05. Score: 4 | Accepted answer

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. Questions purely about the functionality of functions in the core distribution of R are best sent to R-help, which is a mailing list rather than web forum (see <https://www.r-project.org/mail.html> and <https://stat.ethz.ch/mailman/listinfo/r-help>).


---

### Answer by username_2 on 2020-07-03. Score: 0

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")

> **Comments:**
> **username_0**: 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?  
> **username_2**: 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...  

---

