text: user9090: 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 
  
  
  user9042: 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).
  
original_text: 9090: <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>
   9042: <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>
  