model.diversity: Find the best GLM model explaining the alpha divesity of the...

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

View source: R/DiversityOccu.R

Description

This function takes a diversityoccu object and heuristically searches for the glm that best explains the alpha diversity of the modelled species.

Usage

1
model.diversity(DivOcc, delta = 2, form)

Arguments

DivOcc

is an object returned by the divesityoccu function of this package

delta

the number of models that will be returned will be the ones that have a maximum AICc difference with the top model equal to delta.

form

is the formula to use in the glm, a character in the form of "~ x1 + x2 + I(x1^2)

Details

This function fits every first order glm possible and ranks them by AICc.

Value

An object with the best fitted model, the coefficients of that model, a table with the top 5 fitted models ranked by AICc and the data used for the model

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
19
20
21
22
23
24
25
26
27
28
29
30
31
## Not run: 
#Load the data
data("IslandBirds")
data("Daily_Cov")
data("siteCov")

#Model the abundance for  5 bat species and calculate alpha diversity from that

BirdDiversity <-diversityoccu(pres = IslandBirds, sitecov = siteCov,
obscov = Daily_Cov,spp =  5, form = ~ Day + Wind + Time + Rain +
Noise ~ Elev + AgroFo + SecVec + Wetland + Upland)

#Select the best model that explains diversity using genetic algorithms
set.seed(123)
glm.Birdiversity <- model.diversity(BirdDiversity, method = "g")

#see the best models

glm.Birdiversity$Best.model

#plot the response of diversity to individual variables

plot(glm.Birdiversity, elev)

#To add the quadratic components of models

glm.birdiversity <- model.diversity(BirdDiversity , method = "g", squared = TRUE)

responseplot.diver(glm.birdiversity, Elev)

## End(Not run)

derek-corcoran-barrios/DiversityOccu documentation built on Nov. 12, 2019, 7:31 p.m.