Function fit an ellipsoid model using the shape matrix (covariance matrix) of the niche variables.
ellipsoidfit( envlayers, centroid, covar, level = 0.95, plot = T, size, xlab1 = "niche var 1", ylab1 = "niche var 2", zlab1 = "S", ... )
envlayers | A RasterStack or RasterBrick object of the niche variables. |
---|---|
centroid | A vector with the values of the centers of the ellipsoid (see |
covar | The shape matrix (covariance) of the ellipoid (see |
level | The proportion of points to be included inside the ellipsoid |
plot | Logical If True a plot of the niche will be shown. |
size | The size of the points of the niche plot. |
xlab1 | For x label for 2-dimensional histogram |
ylab1 | For y label for 2-dimensional histogram |
zlab1 | For z label for 2-dimensional histogram |
... | Arguments passed to |
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.
## Load niche data if (FALSE) { d_cardon <- read.csv(system.file("extdata", "cardon_virtual.csv", package = "ntbox")) ## 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 <- raster::stack(list.files(system.file("extdata", package = "ntbox"), pattern = ".asc$", full.names = TRUE)) # Fitting the ellipsoid model ellipsoidMod <- ellipsoidfit(nicheStack, covar_centroid$centroid, covar_centroid$covariance, level=0.99,plot=TRUE,size=3) plot(ellipsoidMod$suitRaster) }