[R-sig-eco] GLM: calculate percentage deviance of factor

Martin Weiser weiser2 at natur.cuni.cz
Fri Nov 30 13:40:16 CET 2012


Jade Maggs píše v Čt 01. 11. 2012 v 16:02 +0200:
> Dear list,
> 
> I have run a generalized linear model with negative binomial 
> distribution (log-link) on fish abundance data.
> 
> log(abundTot) ~ Bo + B1(topog) + B2(activity) + e
> 
> *My output is as follows**:*
> 
> summary(glmNB1)
> Call: glm.nb(formula = abundTot ~ activity + topog, init.theta = 
> 5.431057349,
>      link = log)
> Deviance Residuals:
>      Min       1Q   Median       3Q      Max
> -3.1348  -0.7846  -0.2781   0.3097   5.3866
> Coefficients:
>                  Estimate Std. Error z value Pr(>|z|)
> (Intercept)      2.65215    0.07810  33.958  < 2e-16 ***
> activity[T.hd]  -0.04447    0.08299  -0.536   0.5921
> activity[T.hfd] -0.44926    0.08884  -5.057 4.27e-07 ***
> activity[T.nil]  0.07510    0.05808   1.293   0.1960
> topog            0.03084    0.01546   1.995   0.0461 *
> ---
> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
> 
> (Dispersion parameter for Negative Binomial(5.4311) family taken to be 1)
> 
>      Null deviance: 473.32  on 428  degrees of freedom Residual 
> deviance: 428.00  on 424  degrees of freedom
> AIC: 2916.3
> 
> Number of Fisher Scoring iterations: 1
> 
> 
>                Theta:  5.431
>            Std. Err.:  0.485
> 
> 2 x log-likelihood:  -2904.260
> 
> *and*
> anova(glmNB1)
> Analysis of Deviance Table
> 
> Model: Negative Binomial(5.4311), link: log
> 
> Response: abundTot
> 
> Terms added sequentially (first to last)
> 
> 
>           Df Deviance Resid. Df Resid. Dev  Pr(>Chi)
> NULL                       428     473.32
> activity  3   41.272       425     432.05 5.726e-09 ***
> topog     1    4.053       424     428.00    0.0441 *
> ---
> Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
> 
> Please can someone explain how to calculate the percentage deviance 
> explained by each factor separately (i.e. topog and activity).
> 
> Kind regards,
> 

Dear Jade,
as far as I know (and feel free to correct me, anybody), traditional
goodness of fit measure - R squared (or ratio of sum of squares) is not
strictly defined for models other than linear. You should look for some
alternative, eg. Nagelkerke's R-squared, but be warned that these
alternatives sometimes lack some usual properties of R2 like aditivity -
sum of Your "explained variances" for individual factors would not be
the same as the "explained variance" of the full model. 
I hope this helps.
Martin Weiser



More information about the R-sig-ecology mailing list