Data preparation
Data <- read.csv("Covernet.csv", header=T)
Length <- Data$Length
Codend <- Data[,seq(2,12,2)]
Cover <- Data[,seq(3,13,2)]
Encounter <- Codend + Cover
NN <- Codend + Cover
Selectivity <- Codend/Encounter
Duration <- c(20,20,20,60,60,60)
Repeat <- c(1,2,3,4,5,6)
Text <- c("20min(1)","20min(2)","20min(3)","60min(1)","60min(2)","60min(3)")
par(mfcol=c(3,2))
Ntrial <- 6
for(i in 1:Ntrial)
{
par(mar=c(4,4,4,5))
plot(Length, Selectivity[,i], ylim=c(0,1), ylab="Selectivity", main=Text[i])
par(new=T)
plot(Length, NN[,i], type="h", axes=F, ylab="", ylim=c(1,max(NN)))
axis(4); mtext("#Encounters", side=4, line=2, cex=0.7)
}

GLM analysis by haul
Res.glm0 <- NULL
Para0 <- array(NA, c(Ntrial, 2))
colnames(Para0) <- c("a","b")
Retention <- function(x,para){ 1/(1+exp(-para[1]-para[2]*x)) }
par(mfcol=c(3,2))
for(i in 1:Ntrial){
Res.glm0[[i]] <- glm(cbind(Codend[,i],Cover[,i])~Length, family=binomial)
Para0[i,] <- Res.glm0[[i]]$coefficients
plot(Length, Selectivity[,i], ylim=c(0,1), ylab="Selectivity", main=Text[i])
curve(Retention(x,Para0[i,]), add=TRUE)
}

Para0
## a b
## [1,] -26.361227 0.7347294
## [2,] -14.946438 0.4126321
## [3,] -9.819376 0.2785152
## [4,] -7.204277 0.1938873
## [5,] -11.980199 0.3407501
## [6,] -10.661597 0.2901800
sum(as.numeric(lapply(Res.glm0, AIC)))
## [1] 385.9945
Combined GLM analysis over hauls
Codend.vec <- as.vector(as.matrix(Codend))
Cover.vec <- as.vector(as.matrix(Cover))
Length.vec <- rep(Length, Ntrial)
Repeat.vec <- factor(rep(Repeat, each=length(Length)))
CC <- cbind(Codend.vec,Cover.vec)
Res.glm1 <- glm(CC ~ -1+Repeat.vec+Length.vec*Repeat.vec, family=binomial)
Res.glm1
##
## Call: glm(formula = CC ~ -1 + Repeat.vec + Length.vec * Repeat.vec,
## family = binomial)
##
## Coefficients:
## Repeat.vec1 Repeat.vec2 Repeat.vec3
## -26.3612 -14.9464 -9.8194
## Repeat.vec4 Repeat.vec5 Repeat.vec6
## -7.2043 -11.9802 -10.6616
## Length.vec Repeat.vec2:Length.vec Repeat.vec3:Length.vec
## 0.7347 -0.3221 -0.4562
## Repeat.vec4:Length.vec Repeat.vec5:Length.vec Repeat.vec6:Length.vec
## -0.5408 -0.3940 -0.4445
##
## Degrees of Freedom: 173 Total (i.e. Null); 161 Residual
## Null Deviance: 1776
## Residual Deviance: 149 AIC: 386
Duration.vec <- factor(rep(Duration, each=length(Length)))
Res.glm2 <- glm(CC ~ -1+Duration.vec+Length.vec*Duration.vec, family=binomial)
Res.glm2
##
## Call: glm(formula = CC ~ -1 + Duration.vec + Length.vec * Duration.vec,
## family = binomial)
##
## Coefficients:
## Duration.vec20 Duration.vec60
## -10.86003 -8.95278
## Length.vec Duration.vec60:Length.vec
## 0.30982 -0.06467
##
## Degrees of Freedom: 173 Total (i.e. Null); 169 Residual
## Null Deviance: 1776
## Residual Deviance: 189.8 AIC: 410.8
Res.glm3 <- glm(CC ~ -1+Duration.vec+Length.vec, family=binomial)
Res.glm3
##
## Call: glm(formula = CC ~ -1 + Duration.vec + Length.vec, family = binomial)
##
## Coefficients:
## Duration.vec20 Duration.vec60 Length.vec
## -9.0478 -9.4523 0.2596
##
## Degrees of Freedom: 173 Total (i.e. Null); 170 Residual
## Null Deviance: 1776
## Residual Deviance: 196.3 AIC: 415.3
Res.glm4 <- glm(CC ~ Length.vec*Duration.vec, family=binomial)
Res.glm4
##
## Call: glm(formula = CC ~ Length.vec * Duration.vec, family = binomial)
##
## Coefficients:
## (Intercept) Length.vec
## -10.86003 0.30982
## Duration.vec60 Length.vec:Duration.vec60
## 1.90725 -0.06467
##
## Degrees of Freedom: 172 Total (i.e. Null); 169 Residual
## Null Deviance: 1513
## Residual Deviance: 189.8 AIC: 410.8
Res.glm5 <- glm(CC ~ Length.vec, family=binomial)
Res.glm5
##
## Call: glm(formula = CC ~ Length.vec, family = binomial)
##
## Coefficients:
## (Intercept) Length.vec
## -9.4615 0.2632
##
## Degrees of Freedom: 172 Total (i.e. Null); 171 Residual
## Null Deviance: 1513
## Residual Deviance: 204.7 AIC: 421.7
Res.glm6 <- glm(CC ~ -1+Repeat.vec+Length.vec*Duration.vec, family=binomial)
Res.glm6
##
## Call: glm(formula = CC ~ -1 + Repeat.vec + Length.vec * Duration.vec,
## family = binomial)
##
## Coefficients:
## Repeat.vec1 Repeat.vec2
## -10.23583 -10.87205
## Repeat.vec3 Repeat.vec4
## -10.73100 -8.99041
## Repeat.vec5 Repeat.vec6
## -8.75276 -9.09720
## Length.vec Duration.vec60
## 0.30420 NA
## Length.vec:Duration.vec60
## -0.05818
##
## Degrees of Freedom: 173 Total (i.e. Null); 165 Residual
## Null Deviance: 1776
## Residual Deviance: 184.3 AIC: 413.3
Res.glm7 <- glm(CC ~ -1+Duration.vec+Length.vec:Repeat.vec, family=binomial)
Res.glm7
##
## Call: glm(formula = CC ~ -1 + Duration.vec + Length.vec:Repeat.vec,
## family = binomial)
##
## Coefficients:
## Duration.vec20 Duration.vec60 Length.vec:Repeat.vec1
## -10.6943 -8.9828 0.3176
## Length.vec:Repeat.vec2 Length.vec:Repeat.vec3 Length.vec:Repeat.vec4
## 0.3005 0.3025 0.2439
## Length.vec:Repeat.vec5 Length.vec:Repeat.vec6
## 0.2555 0.2441
##
## Degrees of Freedom: 173 Total (i.e. Null); 165 Residual
## Null Deviance: 1776
## Residual Deviance: 182.1 AIC: 411.1
lapply(list(Res.glm1,Res.glm2,Res.glm3,Res.glm4,Res.glm5,Res.glm6,Res.glm7), AIC)
## [[1]]
## [1] 385.9945
##
## [[2]]
## [1] 410.8121
##
## [[3]]
## [1] 415.3129
##
## [[4]]
## [1] 410.8121
##
## [[5]]
## [1] 421.7207
##
## [[6]]
## [1] 413.3131
##
## [[7]]
## [1] 411.0692