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
 4
 5
 6
 7
 8
 9
10
11
12
ellipsoidfit(
  data,
  centroid,
  covar,
  level = 0.95,
  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

plot

Logical If True a plot of 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 plot3d function from rgl

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/hsi documentation built on Dec. 26, 2021, 9:53 a.m.