hypervolume_general_model {hypervolume} | R Documentation |
Generates hypervolume by sampling from arbitrary model object.
Description
Uses rejection sampling to obtain predicted values of a model object at uniformly random points within a range box, then converts output to a hypervolume.
Usage
hypervolume_general_model(model, name = NULL, verbose = TRUE,
data = NULL, range.box = NULL, num.samples = ceiling(10^(3 + sqrt(ncol(range.box)))),
chunk.size = 10000, min.value = 0, ...)
Arguments
model |
Any model object which can be used within a |
name |
Name of the output hypervolume |
verbose |
If |
data |
If not |
range.box |
A 2 x n matrix, where n is the number of dimensions of the data, and the first row corresponds to a lower limit and the second row to an upper limit. Each column is thus the low and high limits of the range box along each axis. Can be generated via |
num.samples |
Number of samples to draw from the range box. |
chunk.size |
Number of samples to process in each |
min.value |
If |
... |
Other arguments to be passed to |
Value
A Hypervolume
-class object corresponding to retained values within the hyperbox of interest.
Examples
data(penguins,package='palmerpenguins')
penguins_no_na = as.data.frame(na.omit(penguins))
penguins_no_na$is_adelie = penguins_no_na$species=="Adelie"
penguins_no_na = penguins_no_na[,c("is_adelie","bill_length_mm","bill_depth_mm")]
m_glm = glm(is_adelie~.,data=penguins_no_na)
hv_general_glm = hypervolume_general_model(m_glm,
range.box=padded_range(penguins_no_na[,2:3]),type='response')
plot(hv_general_glm)