In this exercise, we will continue to solve problems from the last exercise about GLM here. Therefore, the exercise number will start at 9. Please make sure you read and follow the previous exercise before you continue practicing. In the last exercise, we knew that there was over-dispersion over the model. So, we tried to […]

## Basic Generalized Linear Modeling – Part 2: Exercises

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 […]

## Fighting Factors with Cats: Exercises

In this exercise set, we will practice using the forcats factor manipulation package by Hadley Wickham. In the last exercise set, we saw that it is entirely possible to deal with factors in base R, but also that things can get a bit involved and un-intuitive. Forcats simplifies many common factor manipulation tasks and […]

## Basic Generalized Linear Modeling – Part 1: Exercises

A generalized linear model (GLM) is a flexible generalization of an ordinary linear regression that allows for response variables that have error distribution models other than a normal distribution. The GLM generalizes linear regression by allowing the linear model to be related to the response variable via a link function. It also allows the magnitude […]

## Facing the Facts about Factors: Exercises

Factor variables in R can be mind-boggling. Often, you can just avoid them and use characters vectors instead – just don’t forget to set stringsAsFactors=FALSE. They are, however, very useful in some circumstances, such as statistical modelling and presenting data in graphs and tables. Relying on factors but misunderstanding them has been known to “eat […]

## Basic Generalized Additive Models In Ecology: Exercises

Generalized Additive Models (GAM) are non-parametric models that add smoother to the data. In this exercise, we will look at GAMs using cubic spline using the mgcv package. Data-sets used can be downloaded here. The data-set is the experiment result of grassland richness over time in the Yellowstone National Park (Skkink et al. 2007). […]

## Melt and Cast The Shape of Your Data-Frame: Exercises

Data-sets often arrive to us in a form that is different from what we need for our modeling or visualization functions, which, in turn, don’t necessarily require the same format. Reshaping data.frames is a step that all analysts need, but many struggle with. Practicing this meta-skill will, in the long-run, result in more time to […]

## Non-Linear Models in R: Exercises

A mechanistic model for the relationship between x and y sometimes needs parameter estimation. When model linearisation does not work,we need to use non-linear modeling. There are three main differences between non-linear and linear modeling in R: 1. Specify the exact nature of the equation. 2. Replace the lm() with nls(), which means non-linear least […]

## Intro To Time Series Analysis – Part 2: Exercises

In the exercises below, we will explore more in the Time Series analysis. The previous exercise can be found here. Please follow this in sequence. Answers to these exercises are available here. Exercise 1 Load the AirPassengers data. Check its class and see the start and end of the series. Exercise 2 Check the cycle of […]

## How To Create a Flexdashboard: Exercises

INTRODUCTION With flexdashboard, you can easily create interactive dashboards for R. What is amazing about it is that with R Markdown, you can publish a group of related data visualizations as a dashboard. Additionally, it supports a wide variety of components, including htmlwidgets; base, lattice, and grid graphics; tabular data; gauges and value boxes […]