<p><div><div><div><div data-show-faces="false" data-height="21" data-width="100" data-layout="button_count" data-send="true" data-href="https://www.r-bloggers.com/basic-generalized-linear-modeling-part-2-exercises/"></div></div><div></div></div><div></div></div>
<div>
(This article was first published on <strong><a href="https://www.r-exercises.com/2018/08/02/basic-generalized-linear-modelling-part-2-exercises/"> R-exercises</a></strong>, and kindly contributed to <a rel="nofollow" href="https://www.r-bloggers.com/">R-bloggers)</a> </div>
<p><a rel="nofollow" href="https://i1.wp.com/www.r-exercises.com/wp-content/uploads/2018/08/programmer-1653351_1280.png?ssl=1" target="_blank"><img sizes="(max-width: 338px) 100vw, 338px" src="https://i0.wp.com/www.r-exercises.com/wp-content/uploads/2018/08/programmer-1653351_1280-300x208.png?resize=338%2C234&ssl=1" alt="" width="338" class="wp-image-11839" data-recalc-dims="1" height="234"></a></p>
<p>In this exercise, we will try to handle the model that has been over-dispersed using the quasi-Poisson model. Over-dispersion simply means that the variance is greater than the mean. It’s important because it leads to inflation in the models and increases the possibility of Type I errors. We will use a data-set on amphibian road kill (Zuur et al., 2009). It has 17 explanatory variables. We’re going to focus on nine of them using the total number of kills (TOT.N) as the response variable.</p>
<p>Please download the data-set <a rel="nofollow" href="https://www.dropbox.com/s/ewvaed1gbhlz45o/RoadKills%20w9.csv?dl=0" target="_blank">here</a> and name it “Road.” Answers to these exercises are available <a rel="nofollow" href="https://www.r-exercises.com/2018/08/02/basic-generalised-linear-modelling-part-2-solutions/" target="_blank">here</a>. If you obtained a different (correct) answer than those listed on the solutions page, please feel free to post your answer as a comment on that page. Load the data-set and required package before running the exercise.</p>
<p><strong>Exercise 1</strong><br>
Doing some plotting, we can see decreasing variability of kills with distance.</p>
<p><strong>Exercise 2</strong><br>
Run the GLM model with distance as the explanatory variables.</p>
<p><strong>Exercise 3</strong><br>
Add more co-variables to the model and see what’s happening by checking the model summary.</p>
<p><strong>Exercise 4</strong><br>
Check the co-linearity using VIF’s. Set options in Base R concerning missing values.</p>
<p><strong>Exercise 5</strong><br>
Check the summary again and set base R options. See why we do this on the <a rel="nofollow" href="https://www.r-exercises.com/2018/07/19/basic-generalised-linear-modelling-part-1-exercises/" target="_blank">previous related post</a> exercise.</p>
<p><strong>Exercise 6</strong><br>
Check for over-dispersion (rule of thumb, value needs to be around 1.) If it is still greater or less than 1, then we need to check diagnostic plots and re-run the GLM with another structure model.</p>
<p><strong>Exercise 7</strong><br>
Restructure the model by throwing out the least significant terms and repeat the model until generating fewer significant terms.</p>
<p><strong>Exercise 8</strong><br>
Check the diagnostic plots. If there are still some problems, then we might need to use other types of regression, like Negative Binomial regression. We’ll discuss it in the next exercise post.</p>
<div>
<h3>Related exercise sets:</h3>
<ol>
<li><a rel="nofollow" href="https://www.r-exercises.com/2017/11/29/spatial-data-analysis-introduction-to-raster-processing-part-1/" title="Spatial Data Analysis: Introduction to Raster Processing (Part 1)" target="_blank">Spatial Data Analysis: Introduction to Raster Processing (Part 1) </a></li>
<li><a rel="nofollow" href="https://www.r-exercises.com/2018/02/28/advanced-techniques-with-raster-data-part-1-unsupervised-classification/" title="Advanced Techniques With Raster Data: Part 1 – Unsupervised Classification" target="_blank">Advanced Techniques With Raster Data: Part 1 – Unsupervised Classification </a></li>
<li><a rel="nofollow" href="https://www.r-exercises.com/2018/01/10/spatial-data-analysis-introduction-to-raster-processing-part-3/" title="Spatial Data Analysis: Introduction to Raster Processing: Part-3" target="_blank">Spatial Data Analysis: Introduction to Raster Processing: Part-3 </a></li>
<li><a rel="nofollow" href="http://www.r-exercises.com/start-here-to-learn-r/" target="_blank">Explore all our (>1000) R exercises</a></li>
<li><a rel="nofollow" href="http://www.r-exercises.com/r-courses/" target="_blank">Find an R course using our R Course Finder</a> directory</li>
</ol>
</div>
	<p>
<div>
<div>To <strong>leave a comment</strong> for the author, please follow the link and comment on their blog: <strong><a href="https://www.r-exercises.com/2018/08/02/basic-generalized-linear-modelling-part-2-exercises/"> R-exercises</a></strong>.</div>
<hr>
<a rel="nofollow" href="https://www.r-bloggers.com/">R-bloggers.com</a> offers <strong><a rel="nofollow" href="https://feedburner.google.com/fb/a/mailverify?uri=RBloggers">daily e-mail updates</a></strong> about <a rel="nofollow" href="https://www.r-project.org/" title="The R Project for Statistical Computing">R</a> news and <a rel="nofollow" href="https://www.r-bloggers.com/search/tutorial" title="R tutorials">tutorials</a> on topics such as: <a rel="nofollow" href="https://www.r-bloggers.com/search/data%20science" title="Data science">Data science</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/Big%20Data" title="Big Data">Big Data, <a rel="nofollow" href="https://www.r-users.com/" title="R jobs">R jobs</a>, visualization (<a rel="nofollow" href="https://www.r-bloggers.com/search/ggplot2" title="ggplot and ggplot2 tutorials">ggplot2</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/boxplot" title="Boxplots using lattice and ggplot2 tutorials">Boxplots</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/map" title="Maps and gis">maps</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/animation" title="Animation in R">animation</a>), programming (<a rel="nofollow" href="https://www.r-bloggers.com/search/RStudio" title="RStudio IDE for R">RStudio</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/sweave" title="Sweave and literate programming">Sweave</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/LaTeX" title="LaTeX in R">LaTeX</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/SQL" title="SQL and databases">SQL</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/eclipse" title="Eclipse IDE for R">Eclipse</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/git" title="git and github, Version Control System">git</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/hadoop" title="Large data in R using Hadoop">hadoop</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/Web+Scraping" title="Web Scraping of google, facebook, yahoo, twitter and more using R">Web Scraping</a>) statistics (<a rel="nofollow" href="https://www.r-bloggers.com/search/regression" title="Regressions and ANOVA analysis tutorials">regression</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/PCA" title="principal component analysis tutorial">PCA</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/time+series" title="Time series">time series</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/trading" title="finance trading">trading</a>) and more...
<img width="1" alt="" src="http://feeds.feedburner.com/~r/RBloggers/~4/voe5WgDNqa0" height="1"></a></div>