ellipsoidfit: Function fit an ellipsoid model

Description Usage Arguments Value Examples

View source: R/ellipsoidfit.R

Description

Function fit an ellipsoid model using the shape matrix (covariance matrix) of the niche variables.

Usage

1
2
3
ellipsoidfit(data, centroid, covar, level = 0.95, threshold = 0.05,
  plot = T, size, xlab1 = "niche var 1", ylab1 = "niche var 2",
  zlab1 = "Suitability", ...)

Arguments

data

A RasterStack or RasterBrick objet of the niche varibles.

centroid

A vector with the values of the centers of the ellipsoid (see cov_center).

covar

The shape matrix (covariance) of the ellipoid (see cov_center).

level

The proportion of points to be included inside the ellipsoid

threshold

Threshold value for the suitabilities to be cosidered as 0, by default all suiabilities <0.05 are cosidered as zeros

plot

Logical If True a plot of niche will be shown.

size

The size of the points of the niche plot.

Value

Returns a list containing a data.frame with the suitability values; a suitability raster; a data.frame with the mahalanobis and euclidean distances to the centroid.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
## Load niche data
# d_cardon <-  read.csv(system.file("extdata", "cardon_virtual.csv", package = "nichetoolbox"))
## Compute the centroid and shape (covariance matrix) of the ellipsoid model.
# covar_centroid <- cov_center(d_cardon,mve=TRUE,level=0.99,vars=c(3,4,5))
## RasterStack with the niche variables
# nicheStack <- stack(list.files(system.file("extdata",
#                   package = "nichetoolbox"),
#                   pattern = ".asc$",full.names = TRUE))
# Fitting the ellipsoid model
# ellipsoidMod <- ellipsoidfit(nicheStack,
#                          covar_centroid$centroid,
#                          covar_centroid$covariance,
#                          level=0.95,threshold=0.05,plot=TRUE,size=3)
# plot(ellipsoidMod$suitRaster)

luismurao/nichetoolbox documentation built on May 21, 2017, 3:42 p.m.