Learn R Programming

hypervolume (version 3.1.4)

hypervolume_n_resample: Bootstrap n hypervolumes

Description

The function hypervolume_n_resample() generates n hypervolumes using data bootstrapped from original data of the input hypervolumes.

Usage

hypervolume_n_resample(name,
                       hv_list,
                       n = 10,
                       points_per_resample = 'sample_size',
                       cores = 1,
                       verbose = TRUE,
                       seed = NULL)

Value

Returns a string containing an absolute path equivalent to ./Objects/<name>

Arguments

name

File name; The function writes hypervolumes to file in "./Objects/<name>""

hv_list

A Hypervolume or HypervolumeList object.

n

Number of resamples to take. Used for every method.

points_per_resample

Number of points in each resample. If the input is sample_size, then the same number of points as the original sample is used.

cores

Number of logical cores to use while generating bootstraped hypervolumes. If parallel backend already registered to doParallel, function will use that backend and ignore the argument in cores.

verbose

Logical value; If function is being run sequentially, outputs progress bar in console.

seed

Set seed for random number generation.

Details

hypervolume_n_resample() creates a directory called Objects in the current working directory if a directory of that name doesn't already exist. A directory is then created for each hypervolume in hv_list. Returns an absolute path to directory with resampled hypervolumes.
It is possible to access the hypervolumes by using readRDS to read the hypervolume objects one by one.
The resampled hypervolumes are generated using the same parameters used to generate the input hypervolume. The only exception is that the bandwidth is re-estimated if method = "gaussian" or method = "box". See copy_param_hypervolume for more details.

See Also

hypervolume_n_occupancy_bootstrap

Examples

Run this code
if (FALSE) {

library(palmerpenguins)
data(penguins)
bill_data = na.omit(penguins[,3:4])
hv = hypervolume(bill_data)

# Example 1: get 50 resampled hypervolumes for each input hypervolume
# Use detectCores to see how many cores are availible in current environment
# Set cores = 1 to run sequentially (default)
# bootstrap the hypervolumes
hv_list_boot = hypervolume_n_resample(name = "example", hv_list, n = 50)

}

Run the code above in your browser using DataLab