如何绘制泊松GLMM的预测值

时间:2017-12-15 22:02:55

标签: r

我使用lme4包中的glmer来拟合模型。我使用以下代码来拟合模型。

  GLMmmia.4<- glmer(Total_abun ~
                      EC+ DO_sat  + TP+   
                        Vegetationcover  +(1 | Season), data=wetlandmacro , family=poisson,  control=lmerControl(optimizer="bobyqa",optCtrl=list(maxfun=2e4)))

> summary(GLMmmia.4)
Generalized linear mixed model fit by maximum likelihood (Laplace
  Approximation) [glmerMod]
 Family: poisson  ( log )
Formula: 
Total_abun ~ EC + DO_sat + TP + Vegetationcover + (1 | Season)
   Data: wetlandmacro
Control: 
lmerControl(optimizer = "bobyqa", optCtrl = list(maxfun = 20000))

     AIC      BIC   logLik deviance df.resid 
  4817.3   4833.1  -2402.6   4805.3       98 

Scaled residuals: 
    Min      1Q  Median      3Q     Max 
-9.8730 -4.4156 -0.4338  3.1763 19.4737 

Random effects:
 Groups Name        Variance Std.Dev.
 Season (Intercept) 0.009201 0.09592 
Number of obs: 104, groups:  Season, 2

Fixed effects:
                  Estimate Std. Error z value Pr(>|z|)    
(Intercept)      5.0118238  0.0931197   53.82  < 2e-16 ***
EC              -0.0011036  0.0001632   -6.76 1.34e-11 ***
DO_sat          -0.0009736  0.0003168   -3.07  0.00211 ** 
TP               0.2050763  0.0422935    4.85 1.24e-06 ***
Vegetationcover -0.0015678  0.0005251   -2.99  0.00283 ** 
---
Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

Correlation of Fixed Effects:
            (Intr) EC     DO_sat TP    
EC          -0.392                     
DO_sat      -0.521  0.313              
TP          -0.021  0.155 -0.167       
Vegetatncvr -0.617  0.293  0.606 -0.142

我感谢任何有助于绘制响应变量的预测值(物种丰度)作为每个固定效应(环境变量)的函数

1 个答案:

答案 0 :(得分:0)

您可以分别对每个固定效果使用plotfitted。举个例子: plot(fitted(GLMmmia.4)~EC)