predict.gam.bindex: A function to predict CPUE-index from a delta-lognormal GAM...

Description Usage Arguments Examples

Description

This function uses a binomial GAM and a log-normal GAM to compute a delta-lognormal index of abundance with associated 95 strapping the data. A dummy variable for year must be included to get the annual abundance index. The function back-transforms the index and the CI's.

Usage

1
2
## S3 method for class 'gam.bindex'
predict(pa.model, cpue.model, boot_reps = 500)

Arguments

pa.model

binomial GAM predicting presence or absence

cpue.model

log-normal GAM predicting abundance where catch is positive

boot_reps

number of bootstrap replications (default = 500)

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
gam.pa.xvars<-c("inverts","slope","btemp","bdepth")
gam.pa.yvar<-ifelse(PA.data[species.name]>0,1,0)
gam.pa.form <- as.formula(paste("gam.pa.yvar ~", paste(gam.pa.xvars,collapse="+"),"+as.factor(year)",sep=""))
pa.gam <- gam(gam.pa.form, family = binomial, data = PA.data)

CPUE.data<-subset(PA.data,PA.data[species.name]>0)
gam.cpue.yvar<-unlist(log(CPUE.data[species.name]))
gam.cpue.xvars<-c("inverts","slope","btemp","bdepth")
gam.cpue.form <- as.formula(paste("gam.cpue.yvar ~", paste(gam.cpue.xvars,collapse="+"),"+as.factor(year)",sep=""))
cpue.gam <- gam(gam.cpue.form, family = gaussian, data = CPUE.data)

predict.gam.bindex(pa.gam,cpue.gam)

rooperc4/GLMGAMRF documentation built on May 17, 2019, 1:30 p.m.