0

I really need help with this. I want to make a predict model for my glm quasipoisson. I have a problems since i wrongly make a glm model with my dataset. I used to make a predict model based on my glm quasipoisson for all my parameters, but I ended up predicting for each parameter, and the result is different from the glm quasipoisson data.

Here is my dataset. I use a csv file for all my dataset. Idk how to upload this csv data in this post, pardon me for this.

Richness = as.matrix(dat1[,14])
Richness

 8
 3
 3
 4
 3
 5
 4
 3
 7
 8

Parameter = as.matrix(dat1[,15:22])
Parameter
  JE Temp Hmdt  Sond   HE    WE   L    MH
   1 31.3   93  63.3 3.89  4.32  80  7.82
   2 26.9   92  63.5 9.48  8.85  60  8.32
   1 27.3   93  67.4 1.23  2.37  60 10.10
   3 31.6   99 108.0 1.90  3.32  80  4.60
   1 29.3   99  86.8 2.42  7.83 460 12.20
   2 29.4   85  86.1 4.71 15.04 200 10.10
   1 29.4   87  93.5 3.65 14.70 200 12.20
   1 29.5   97  87.5 1.42  3.17  80  4.07
   1 25.9   95  62.3 5.23 16.89 140 10.03
   1 29.5   95  63.5 1.85  6.50 120  6.97

 Rich = glm(Richness ~ Parameter, family=quasipoisson, data = dat1)
 summary(Rich)

 Call:
 glm(formula = Richness ~ Parameter, family = quasipoisson, data = dat1)

 Deviance Residuals: 
    1          2          3          4          5  
 -0.017139   0.016769  -0.008652   0.002194  -0.003153  
    6          7          8          9         10  
 -0.016828   0.022914  -0.013823  -0.012597   0.030219  

 Coefficients:
            Estimate Std. Error t value Pr(>|t|)  
 (Intercept)   -7.4197959  0.5061733 -14.659   0.0434 *
 ParameterJE    0.1833651  0.0224198   8.179   0.0775 .
 ParameterTemp  0.2441301  0.0073380  33.269   0.0191 *
 ParameterHmdt  0.0393258  0.0032176  12.222   0.0520 .
 ParameterSond -0.0319313  0.0009662 -33.050   0.0193 *
 ParameterHE   -0.0982213  0.0060587 -16.212   0.0392 *
 ParameterWE    0.1001758  0.0027575  36.329   0.0175 *
 ParameterL    -0.0014170  0.0001554  -9.117   0.0695 .
 ParameterMH    0.0137196  0.0073704   1.861   0.3138  
 ---
 Signif. codes:  
 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

 (Dispersion parameter for quasipoisson family taken to be 0.002739787)

Null deviance: 7.8395271  on 9  degrees of freedom
Residual deviance: 0.0027358  on 1  degrees of freedom
AIC: NA

Number of Fisher Scoring iterations: 3

This is the model that i tried make with ggplot

ggplot(dat1, aes(Temp, Richness))+
geom_point() +
geom_smooth(method = "glm", method.args = list(family = quasipoisson),
          fill = "grey", color = "black", linetype = 2)``

and this is the result.

enter image description here

I make for each parameters, but i just know this result turn wrong because it used a quasipoisson data for each parameter, what i want is the predict model based on quasipoisson data like in the summary above.

I tried to used the code from plot the results glm with multiple explanatories with 95% CIs, but i really confuse to set my data like the example there. But the result in that example is nearly like what i want. Can anyone help me with this? How can I put the glm predict model for all parameters in one frame with ggplot? Hope anyone can help me to fix this. Thank you so much!

1 Answers1

2

Have you tried the plot_model function from sjplot package? I'm writing from my phone, but the code is something Like this.

library(sjPlot)
plot_model(glm_model)

More info: http://www.strengejacke.de/sjPlot/reference/plot_model.html

code:

data("mtcars")   
glm_model<-glm(am~.,data = mtcars)  
glm_model    

library(sjPlot)    
plot_model(glm_model, vline.color = "red")    
plot_model(glm_model, show.values = TRUE, value.offset = .3)   
DATAUNIRIO
  • 80
  • 6