# Plotting the results of GLM in R

#### nieve5552

##### New Member
I have this data plotted as a scatter plot in Excel I had done a regression in Excel, and the p value was 2.14E-05 while the R- value was 0.32. I was told the R value was too low compared to the significance of the p value, and was told to control for the dispersion of the data by running it through R with GLM with quasipoisson error.

This gave me

glm(formula = encno ~ temp, family = quasipoisson(link = log), data = encnotemp)

Deviance Residuals: Min 1Q Median 3Q Max
-6.008 -2.431 -1.021 1.353 9.441

Coefficients: Estimate Std. Error t value Pr(>|t|)
(Intercept) 2.005807 0.174628 11.486 < 2e-16 ***

temp 0.029065 0.006528 4.453 1.53e-05 ***

Signif. codes: 0 ‘’ 0.001 ‘’ 0.01 ‘’ 0.05 ‘.’ 0.1 ‘ ’ 1

(Dispersion parameter for quasipoisson family taken to be 10.19898)

Null deviance: 1807.4 on 171 degrees of freedom
Residual deviance: 1620.1 on 170 degrees of freedom AIC: NA

Number of Fisher Scoring iterations: 5

How do I analyse this output?

The problem is that the scatterplot data is too dispersed, and I would like to make a scatterplot from the quasipoisson GLM output that shows less dispersed (more fitted) data points. Will this be possible?

Thank you!

#### bugman

##### Super Moderator
Two things:

Have you tried a transformation on your data? and could you post plots of you model diagnostic plots?

#### nieve5552

##### New Member
Maybe Im doing this very wrong but I log transformed the response variable data (encounter number) and plotted it against the untransformed predictor variable (temperature) and got this. I changed all the exact 0s in the response data to 0.001.

What do you mean by plots of model diagnostic plots?

#### bugman

##### Super Moderator
What do you mean by plots of model diagnostic plots?
Code:
plot(glm.model)
Also, Im not entire sure what you are asking. Do you want to plot the fitted values?

#### nieve5552

##### New Member
Code:
plot(glm.model)
Also, Im not entire sure what you are asking. Do you want to plot the fitted values?
Awesome thank you for the code!
Yes I want to fit the fitted values from the quasipoisson glm output, if that is even possible.
I was told that the quasipoisson glm will help with the outliers, and help explore the non linear relationship which is apparently shown in the scatterplot posted in the first question.