ellipsoid_fit | R Documentation |
ellipsoid_fit helps in finding the centroid and matrix that define an ellipsoid. It uses distinct methods with asumptions that differ from each other.
ellipsoid_fit(data, longitude, latitude, method = "covmat",
level = 95, raster_layers = NULL)
data |
data.frame or matrix of occurrence records. Columns must be longitude and latitude. Other columns are optional and would represent values of environmental variables to be used as dimensions for fitting the ellipsoid. |
longitude |
(character) name of the column with longitude data. |
latitude |
(character) name of the column with latitude data. |
method |
(character) method to construct the ellipsoid that characterizes the species ecological niche. Available methods are: "covmat", "mve1", and "mve2". See details. Default = "covmat". |
level |
(numeric) the confidence level of a pairwise confidence region for the ellipsoid, expresed as percentage. Default = 95. See details. |
raster_layers |
optional RasterStack of environmental variables to be
extracted using geographic coordinates present in |
The number of variables that can be used to created "ellipsoids" should be >= 2 for the purposes of this package. When two variables are used "ellipsoids" are ellipses, with three variables "ellipsoids" are ellipsoids, and with more than three variables "ellipsoids" are hyper-ellipsoids.
Details of aregument method
are as follows:
"covmat" creates ellipsoids based in the centriod and a matrix of covariances of the variables used. A particularity of this method is that the centroid will always be located in the center of the destribution of the entire data. This is, the density of points in the plane of analyses matters. Analyses are performed with base functions from R.
"mve1" generates an ellipsoid that reduces the volume contained it without loosing the data contained (i.e., minimum volume ellipsoid). This method may modify the position of the centroid and the values in the covariance matrix that can be obtained using the "covmat" method.
"mve2" as with the previous method, this one also creates a minimum volume ellipsoid. However, the algorithm for creating ellipsoids used here is different. The ellipsoids created in this method are called moment based minimum volume ellipsoids and, as with the previous method, they may suffer changes in the position of the centroid and the values of the covariance matrix if compared to the "covmat" method. In general ellipsoids created with this method have smaller volumes than the ones created with previous methods.
Argument level
defines the limit of the elipsoid as the percentage of
data to be included inside it. In the context of ecological niche modeling,
this argument represents the percentage of error that the data may contain
owing to the diverse types of biases derived from sampling, georeferencing,
identification, or other types of problems related to data management and
storage.
An object of class ellipsoid
.
# reading data
occurrences <- read.csv(system.file("extdata", "occurrences.csv",
package = "ellipsenm"))
# raster layers of environmental data
vars <- raster::stack(list.files(system.file("extdata", package = "ellipsenm"),
pattern = "bio", full.names = TRUE))
# fitting an ellipsoid using normal covariance matrix
ellips <- ellipsoid_fit(data = occurrences, longitude = "longitude",
latitude = "latitude", method = "covmat",
level = 99, raster_layers = vars)
class(ellips) # the class created in this package for this type of object
str(ellips)
# using only a matrix of data and no raster layers, also another method
occurrences1 <- cbind(occurrences[, 2:3], raster::extract(vars, occurrences[, 2:3]))
ellips1 <- ellipsoid_fit(occurrences1, longitude = "longitude", latitude = "latitude",
method = "mve1", level = 99)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.