Description Usage Arguments Value Examples
Function to compute the covariance matrix, the niche centroid and volume of an ellipsoid model. It uses the values of the niche variables of the ocurrences points.
1 | cov_center(data, mve = TRUE, level, vars = NULL)
|
data |
A data.frame or a matrix with the numeric values of the variables that will be used to model the niche. |
mve |
A logical value. If TRUE a minimum volume ellipsoid will be computed using
the function |
level |
A numerical value specifying the proportion of the data to be used to compute the ellipsoid. |
vars |
A numeric or a string vector specifying the columns indexes/names of the variables of the input data which will be used to fit the ellipsoid model. If NULL the user will be asked to enter the indexes. interactively |
Returns a list containing the centroid of the ellipsoid, the covariance matrix based on the input data, ellipsoid volume, semi-axis length and axis coordinates.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 | ## Not run:
cardon_data <- read.csv(system.file("exdata/cardon_virtual.csv",
package = "hsi"))
cardon_ellipsoid <- cov_center(data=cardon_data, mve=TRUE, level=0.975,
vars=c("bio5","bio6", "bio12"))
# To obtain the coordinates of the ellipsoid's centroid run:
print(cardon_ellipsoid$centroid)
# To obtain the coordinates of the ellipsoid's minimum value covariance run:
print(cardon_ellipsoid$covariance)
# To obtain the coordinates of the ellipsoid's niche volume run:
print(cardon_ellipsoid$niche_volume)
# To obtain the coordinates of the ellipsoid's Semi Axis Length run:
print(cardon_ellipsoid$SemiAxis_length)
# To obtain the coordinates of the ellipsoid's coordinates run:
print(cardon_ellipsoid$axis_coordinates)
# To plot the ellipsoid with a 99% of data conteined from the obtained
# by minimim volume method
library(rgl)
ellipsoid_coor <- rgl::ellipse3d(x=cardon_ellipsoid$covariance,centre=cardon_ellipsoid$centroid,
level=0.99)
rgl::plot3d(ellipsoid_coor, alpha=0.3)
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.