modOverlap: Overall overlap between model predictions

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

View source: R/modOverlap.R

Description

This function calculates the degree of overlap between the predictions of two models, using niche comparison metrics such as Schoener's D, Hellinger distance and Warren's I.

Usage

1
modOverlap(pred1, pred2, na.rm = TRUE)

Arguments

pred1

numeric vector of the predictions of a generalized linear model (values between 0 and 1).

pred2

numeric vector of the predictions of another generalized linear model; must be of the same length and in the same order as 'pred1'.

na.rm

logical value indicating whether NA values should be removed prior to calculation. The default is TRUE.

Details

See Warren et al. (2008).

Value

This function returns a list of 3 metrics:

SchoenerD

Schoener's (1968) D statistic for niche overlap, varying between 0 (no overlap) and 1 (identical niches).

WarrenI

the I index of Warren et al. (2008), based on Hellinger distance (below) but re-formulated to also vary between 0 (no overlap) and 1 (identical niches).

HellingerDist

Hellinger distance (as in van der Vaart 1998, p. 211) between probability distributions, varying between 0 and 2.

Note

Thanks to Heidi K. Mod for reporting a typo in a previous version of the function. Another function providing similar measures, niche.overlap, is available in package phyloclim, but it requires complex and software-specific input data formats.

Author(s)

A. Marcia Barbosa

References

Schoener T.W. (1968) Anolis lizards of Bimini: resource partitioning in a complex fauna. Ecology 49: 704-726

van der Vaart A.W. (1998) Asymptotic statistics. Cambridge Univ. Press, Cambridge (UK)

Warren D.L., Glor R.E. & Turelli M. (2008) Environmental niche equivalency versus conservatism: quantitative approaches to niche evolution. Evolution, 62: 2868-83 (and further ERRATUM)

See Also

fuzSim; niche.overlap in package phyloclim

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
# get an environmental favourability model for a rotifer species:

data(rotif.env)

names(rotif.env)

fav_current <- multGLM(rotif.env, sp.cols = 18, var.cols = 5:17,  
step = TRUE, FDR = TRUE, trim = TRUE, P = FALSE, Fav = TRUE) $
predictions


# imagine you have a model prediction for this species in a future time
# (here we will create one by randomly jittering the current predictions)

fav_imag <- jitter(fav_current, amount = 0.2)
fav_imag[fav_imag < 0] <- 0
fav_imag[fav_imag > 1] <- 1


# calculate niche overlap between current and imaginary future predictions:

modOverlap(fav_current, fav_imag)

Example output

 [1] "TDWG4"                    "LEVEL_NAME"              
 [3] "REGION_NAME"              "CONTINENT"               
 [5] "Area"                     "Altitude"                
 [7] "AltitudeRange"            "HabitatDiversity"        
 [9] "HumanPopulation"          "Latitude"                
[11] "Longitude"                "Precipitation"           
[13] "PrecipitationSeasonality" "TemperatureAnnualRange"  
[15] "Temperature"              "TemperatureSeasonality"  
[17] "UrbanArea"                "Abrigh"                  
[19] "Afissa"                   "Apriod"                  
[21] "Bangul"                   "Bcalyc"                  
[23] "Bplica"                   "Bquadr"                  
[25] "Burceo"                   "Cgibba"                  
[27] "Edilat"                   "Flongi"                  
[29] "Kcochl"                   "Kquadr"                  
[31] "Ktropi"                   "Lbulla"                  
[33] "Lclost"                   "Lhamat"                  
[35] "Lluna"                    "Llunar"                  
[37] "Lovali"                   "Lpatel"                  
[39] "Lquadr"                   "Mventr"                  
[41] "Ppatul"                   "Pquadr"                  
[43] "Pvulga"                   "Specti"                  
[45] "Tpatin"                   "Tsimil"                  
[47] "Ttetra"                  
All 291 observations used for model training;
              none reserved for model testing.


=> Building model 1 of 1 (Abrigh)...

13 input predictor variable(s)

10 variable(s) excluded by 'FDR' function
 TemperatureSeasonality, UrbanArea, AltitudeRange, Temperature, Longitude, TemperatureAnnualRange, Precipitation, Altitude, Latitude, PrecipitationSeasonality 

0 variable(s) excluded by 'step' function
  

1 variable(s) excluded by 'modelTrim' function
 Area 

2 variable(s) INCLUDED IN THE FINAL MODEL
 HabitatDiversity, HumanPopulation

Finished!
It took 0.2 secs.
$SchoenerD
[1] 0.9006453

$WarrenI
[1] 0.9923376

$HellingerDist
[1] 0.1237935

fuzzySim documentation built on Feb. 4, 2020, 5:06 p.m.