# Plotting results from a GLM in R

I'm a complete novice when it comes to stats, so my question may not even be relevant. I have been using the glm() function in R to model a response variable (bird species) versus predictor variables (habitat variables etc.) with a Poisson distribution. I selected the best model based on the AIC. Now I'm curious if I can visualize the results in some way. Basically, can I plot the response versus the predictor variables? I want to try and figure out the optimum habitat variables for each bird species. For example: let's say Yellow Warbler had a positive relationship with Shrub Height... but what is the optimal height??

• Have you stumbled upon this tutorial? – Antoni Parellada Feb 1 '17 at 21:56
• The big question is how you're modeling this. If you are modeling the relationships as linear (in the space of $\log(\hat\lambda_i)$), the line has to go up (or down) as you move along any predictor variable. Therefore, the 'optimum' has to be infinity, negative infinity (or 0 or some other bound as appropriate). – gung Feb 1 '17 at 22:03
• It'd surely help if you could give more details about your model. But for the sake of brevity, take a look at the sjPlot package, function sjp.glm – Diogo B Provete Feb 2 '17 at 12:36
• Thank you, Antoni, I had seen that tutorial and I will try to work though it more. Here is an example of the code I am using:AMGOmod.1 <- glm(AMGO ~ mowtime + VegHgt.Avg + VegHgt.Stdv + AvgCanopy + Avg.TreeHgt + Avg.ShrubHgt + Avg.ShrubWdt + ShrubSTM + TreeSTM, data=datastepreg2016, family = poisson) – Lisa Feb 2 '17 at 16:28
• Thanks so much Diogo!! I'm not positive (again, excuse my lack of stats knowledge) but the sjp.glm function seems to be what I was looking for! – Lisa Feb 2 '17 at 17:33