Below are the solutions to these exercises on “GLM – Part 4.” if (!require(car)){install.packages(car, dep=T)} library(car) if (!require(MuMIn)){install.packages(MuMIn, dep=T)} ## Warning: package ‘MuMIn’ was built under R version 3.4.4 library(MuMIn) spider<-read.csv(file.choose()) ############### # # # Exercise 1 # # # ############### # Visualise the data table(spider$PA) ## ## 0 1 ## 9 10 op <- […]
GLM
Basic Generalized Linear Modeling – Part 4: Exercises
This exercise is going to be the last exercise on Basic Generalized Linear Modeling (GLM). Please click here to find the other part of the Basic GLM Exercise that you’ve missed. In this exercise, we will discuss Logistic Regression models as one of the GLM methods. The model is used where the response data is […]
Basic Generalized Linear Modeling – Part 3: Solutions
Below are the solutions to these exercises on “GLM – Part 3.” Please note, you need to execute the answer in this exercise, along with the solutions of Basic GLM Exercises – Part 2 here. ############### # # # Exercise 9 # # # ############### Road.nb1 <- glm.nb(TOT.N ~ OPEN.L + MONT.S + POLIC + […]
Basic Generalized Linear Modeling – Part 3: Exercises
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 […]
Basic Generalized Linear Modeling – Part 2: Solutions
Below are the solutions to these exercises on “GLM – Part 2.” if (!require(car)){install.packages(car, dep=T)} library(car) ############### # # # Exercise 1 # # # ############### rm(list=ls()) Road<-read.csv(file.choose()) plot(Road$D.PARK,Road$TOT.N,xlab=”Distance to park”, ylab=”Road kills”) ############### # # # Exercise 2 # # # ############### Road.glm1<-glm(TOT.N~D.PARK,family=poisson,data=Road) summary(Road.glm1) ## ## Call: ## glm(formula = TOT.N ~ D.PARK, family […]
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 […]
Basic Generalized Linear Modeling – Part 1: Solutions
Below are the solutions to these exercises on “Generalized Linear Modeling – Part 1.” if (!require(car)){install.packages(car, dep=T)} library(car) if (!require(MuMIn)){install.packages(“MuMIn”, dep=T)} ## Warning: package ‘MuMIn’ was built under R version 3.4.4 library(MuMIn) ############### # # # Exercise 1 # # # ############### #load data and check data structure gotelli<-read.csv(file.choose()) require(car) scatterplotMatrix(~Srich + Habitat * Latitude […]