-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathChapter2-AmphibiansIntroduction.R
25 lines (18 loc) · 1.33 KB
/
Chapter2-AmphibiansIntroduction.R
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
###########################################################################################################
#### MODEL FITTING AND MODEL SELECTION FOR MODELLING THE INTRODUCTION OF ALIEN AMPHIBIANS IN AUSTRALIA ####
###########################################################################################################
### Fit a set of 9 candidate logistic including different covariates
fit1<-glm(Introduccion~pathway, data=intro, family=binomial())
fit2<-glm(Introduccion~pathway+size, data=intro, family=binomial())
fit3<-glm(Introduccion~long, data=intro, family=binomial())
fit4<-glm(Introduccion~area+long, data=intro, family=binomial())
fit5<-glm(Introduccion~size, data=intro, family=binomial())
fit6<-glm(Introduccion~area, data=intro, family=binomial())
fit7<-glm(Introduccion~status, data=intro, family=binomial())
fit8<-glm(Introduccion~lat, data=intro, family=binomial())
fit9<-glm(Introduccion~are+size, data=intro, family=binomial())
### Load the AICcmodavg library to conduct the model selection procedures
library(AICcmodavg)
candidate<-list(fit1, fit2,fit3, fit4,fit5, fit6,fit7, fit8,fit9) ### Create a list with the 9 candidate models
name<-c("fit1", "fit2", "fit3", "fit4", "fit5","fit6", "fit7", "fit8","fit9")
aic<-aictab(cand.set=candidate, modnames=name, sort = TRUE, second.ord = TRUE) ### Conduct the model selection procedures