Learn R Programming

DiversityOccupancy (version 1.0.5)

batchoccu: Fits occupancy models for multiple species detection history

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

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.

Value

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

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.

See Also

diversityoccu

Examples

Run this code
## 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)

Run the code above in your browser using DataLab