enfa: Ecological-niche factor analysis

enfaR Documentation

Ecological-niche factor analysis

Description

Performs ecological-niche factor analysis using environmental raster data and species presence data.

Usage

enfa(x, s.dat, ...)

## S4 method for signature 'GLcenfa,Raster'
enfa(
  x,
  s.dat,
  filename = "",
  progress = FALSE,
  parallel = FALSE,
  n = 1,
  cl = NULL,
  keep.open = FALSE,
  ...
)

## S4 method for signature 'GLcenfa,Spatial'
enfa(
  x,
  s.dat,
  field,
  fun = "last",
  filename = "",
  progress = FALSE,
  parallel = FALSE,
  n = 1,
  cl = NULL,
  keep.open = FALSE,
  ...
)

## S4 method for signature 'Raster,Raster'
enfa(
  x,
  s.dat,
  scale = TRUE,
  filename = "",
  progress = FALSE,
  parallel = FALSE,
  n = 1,
  cl = NULL,
  keep.open = FALSE,
  ...
)

## S4 method for signature 'Raster,Spatial'
enfa(
  x,
  s.dat,
  field,
  fun = "last",
  scale = TRUE,
  filename = "",
  progress = FALSE,
  parallel = FALSE,
  n = 1,
  cl = NULL,
  keep.open = FALSE,
  ...
)

Arguments

x

Raster* object, typically a brick or stack of ecological raster layers, or a GLcenfa object

s.dat

RasterLayer, SpatialPolygons*, or SpatialPoints* object indicating species presence or abundance

...

Additional arguments for writeRaster

filename

character. Optional filename to save the Raster* output to file. If this is not provided, a temporary file will be created for large x

progress

logical. If TRUE, messages and progress bar will be printed

parallel

logical. If TRUE then multiple cores are utilized for the calculation of the covariance matrices

n

numeric. Number of CPU cores to utilize for parallel processing

cl

optional cluster object

keep.open

logical. If TRUE and parallel = TRUE, the cluster object will not be closed after the function has finished

field

field of s.dat that specifies presence or abundance. This is equivalent to the field argument in the raster package

fun

function or character. Determines what values to assign to cells with multiple spatial features, similar to the fun argument in rasterize. Options are 'first', 'last' (default), and 'count' (see Details)

scale

logical. If TRUE then the values of the Raster* object will be centered and scaled. Depending on the resolution of the climate data and the extent of the study area, this can be quite time consuming. If running this function for multiple species, it is recommended that the climate data be scaled beforehand using the GLcenfa function

Details

The cnfa function is not to be confused with the enfa function. enfa performs ENFA as described by Hirzel et al. (2002) and Basille et al. (2008), and is offered as an alternative to the enfa function in the adehabitatHS package. CENFA::enfa will give different results than adehabitatHS::enfa for versions of adehabitatHS 0.3.13 or earlier, however, for two primary reasons.

First, CENFA::enfa corrects a minor mistake in the calculation of the species covariance matrix. This correction influences the values of the coefficients of specialization in each ecological variable, which will lead to a different interpretation of the degree of specialization. Second, we define the overall marginality M as the norm of the marginality factor mf, rather than the square of the norm of mf.

The default fun = 'last' gives equal weight to each occupied cell. If multiple species observations occur in the same cell, the cell will only be counted once. fun = 'count' will weight the cells by the number of observations.

If there is too much correlation between the layers of x, the global covariance matrix will be singular, and the overall marginality will not be meaningful. In this case, a warning is issued and marginality is returned as NA.

Value

Returns an S4 object of class enfa with the following components:

call

Original function call

mf

Marginality factor. Vector that describes the location of the species Hutchinsonian niche relative to the global niche

marginality

Magnitude of the marginality factor

sf

Specialization factor. Vector of eigenvalues of specialization

specialization

Square root of the mean of the specialization factor

sf.prop

Vector representing the proportion of specialization found in each ENFA factor

co

A matrix describing the amount of marginality and specialization on each ENFA factor

ras

RasterBrick of transformed climate values, with p layers

weights

Raster layer of weights used for ENFA calculation

References

Basille, Mathieu, et al. Assessing habitat selection using multivariate statistics: Some refinements of the ecological-niche factor analysis. Ecological Modelling 211.1 (2008): 233-240.

Hirzel, Alexandre H., et al. Ecological-niche factor analysis: how to compute habitat-suitability maps without absence data?. Ecology 83.7 (2002): 2027-2036.

See Also

GLcenfa, cnfa

Examples

mod1 <- enfa(x = climdat.hist, s.dat = ABPR, field = "CODE")

# using GLcenfa as an initial step
# for multi-species comparison

glc <- GLcenfa(x = climdat.hist)
mod2 <- enfa(x = glc, s.dat = ABPR, field = "CODE")
all.equal(m.factor(mod1), m.factor(mod2))


rinnan/CENFA documentation built on July 19, 2023, 12:58 p.m.