occupancy_bootstrap_gof {hypervolume} | R Documentation |
Goodness of fit metrics for bootstrapped occupancy objects
Description
The occupancy_bootstrap_gof()
function calculates goodness of fit metrics for objects generated with hypervolume_n_occupancy_bootstrap()
.
Usage
occupancy_bootstrap_gof(path, FUN)
Arguments
path |
A path to a directory of bootstrapped hypervolumes generated with |
FUN |
Function to calculate the goodness of fit. It can be |
Details
Goodness of fit metrics are calculated on the difference between input and recomputed volumes for each bootstrapped element (set with n
in hypervolume_n_resample()
). See hypervolume_n_occupancy()
for details on the meaning of input and recomputed hypervolumes.
Value
A one row data.frame
reporting mean, standard deviation, minimum, maximum, median, 2.5%, 25%, 75% ans 97.5% quantiles.
Examples
## Not run:
data(penguins,package='palmerpenguins')
penguins_no_na = as.data.frame(na.omit(penguins))
# split the dataset on species and sex
penguins_no_na_split = split(penguins_no_na,
paste(penguins_no_na$species, penguins_no_na$sex, sep = "_"))
# calculate the hypervolume for each element of the splitted dataset
hv_list = mapply(function(x, y)
hypervolume_gaussian(x[, c("bill_length_mm","bill_depth_mm","flipper_length_mm")],
samples.per.point=100, name = y),
x = penguins_no_na_split,
y = names(penguins_no_na_split))
# transform the list into an HypervolumeList
hv_list = hypervolume_join(hv_list)
# bootstrap hypervolumes based on sex
hv_resample = hypervolume_n_resample(hv_list, name = "boot_example")
# calculate occupancy for each bootstrap
hv_occupancy_bootstrap = hypervolume_n_occupancy_bootstrap(hv_resample,
name = "occupancy_example",
classification = rep(c("female", "male"), 3))
occupancy_bootstrap_gof(hv_occupancy_bootstrap, FUN = "rmse")
## End(Not run)