batchoccu: Fits occupancy models for multiple species detection history

Description Usage Arguments Details Value Author(s) See Also Examples

View source: R/DiversityOccu.R

Description

This function takes a data.frame with multiple detection history from various species in different sites, covariates of each site to calculate occupancy, variables specific to sampling days to calculate probability of detection. It features an automatic model selection when dredge = TRUE.

Usage

1
batchoccu(pres, sitecov, obscov, spp, form, dredge = FALSE)

Arguments

pres

a data.frame where rows are the sites and columns are a series of presence-absence observation from multiple species, every species needs to have the same number of observations.

sitecov

a data.frame where every row is a site, and every column is a measurement of that site, such as elevation or slope, this covariates are usually more constant.

obscov

a list where every element is a data frame with the daily covariates for each site, that is a measurement for each day, such as average temperature of a day, this covariates are usually very .

spp

the number of species in the pres data.frame

form

a formula in the format ~ obscov ~ sitcov, the first arguments will be used to calculate probability of detection and the second part the occupancy.

dredge

default = FALSE, if TRUE, for each species, the best occupancy model will be determined by fitting all possible models and ranking by AICc.

Details

This function fits the single season occupancy model of MacKenzie et al (2002), for multiple species and it can automatically select the best model for each specie based on AICc.

Value

A list with the fitted models for each species and the calculated Alpha diversity for each site.

Author(s)

Derek Corcoran <derek.corcoran.barrios@gmail.com>

See Also

diversityoccu

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
## Not run: 
data("IslandBirds")
data("Daily_Cov")
data("siteCov")
BirdOccupancy <-batchoccu(pres = IslandBirds, sitecov = siteCov, obscov =
Daily_Cov, spp =  5, form = ~ Day + Wind + Rain + Noise + Clouds ~
Elev + AgroFo + SecVec + Wetland)
#plot the response of occupancy to individual variables for species 4 and  5

responseplot.occu(batch = BirdOccupancy, spp = 4, variable = Elev)

responseplot.occu(batch = BirdOccupancy, spp =  5, variable = Elev)

## End(Not run)
#Dredge for all species
BirdOccupancy2 <- batchoccu(pres = IslandBirds, sitecov = siteCov, obscov =
Daily_Cov, spp = 5, form = ~ 1 ~
Elev + AgroFo, dredge = TRUE)

Example output

Loading required package: MuMIn
Loading required package: unmarked
Loading required package: lattice
Loading required package: parallel
Loading required package: Rcpp
Loading required package: reshape2
Warning messages:
1: In rgl.init(initValue, onlyNULL) : RGL: unable to open X11 display
2: 'rgl_init' failed, running with rgl.useNULL = TRUE 
3: .onUnload failed in unloadNamespace() for 'rgl', details:
  call: fun(...)
  error: object 'rgl_quit' not found 
[1] "Species 1 ready!"
[1] "Species 2 ready!"
[1] "Species 3 ready!"
[1] "Species 4 ready!"
[1] "Species 5 ready!"
Fixed terms are "psi(Int)" and "p(Int)"
[1] "Species 1 ready!"
Fixed terms are "psi(Int)" and "p(Int)"
[1] "Species 2 ready!"
Fixed terms are "psi(Int)" and "p(Int)"
[1] "Species 3 ready!"
Fixed terms are "psi(Int)" and "p(Int)"
[1] "Species 4 ready!"
Fixed terms are "psi(Int)" and "p(Int)"
[1] "Species 5 ready!"

DiversityOccupancy documentation built on May 2, 2019, 12:35 p.m.