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, method = "h", delta = 2, squared = FALSE)

Arguments

DivOcc

is an object returned by the divesityoccu function of this package

method

The method to be used to explore the candidate set of models. If "h" an exhaustive screening is undertaken. If "g" the genetic algorithm is employed (recommended for large candidate sets). If "l", a very fast exhaustive branch-and-bound algorithm is used. Package leaps must then be loaded, and this can only be applied to linear models with covariates and no interactions.

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.

squared,

if FALSE (Default), only GLMs with linear components will be evaluated; If TRUE, GLMs with both linear and quadratic components will be evaluated. WARNING if squared is TRUE, the number of parameters duplicates and the models grow exponentially, this may result in to many variables for a CPU to compute.

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)

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