bmbstats: Bootstrap Magnitude-based generic function

Description Usage Arguments Value Examples

View source: R/bmbstats.R

Description

This is the "core" function of the bmbstats package. It performs bootstrap on the data using provided estimator_function, SESOI_lower_function, and SESOI_upper_function. Used in other functions ("wrappers")

Usage

1
2
3
4
5
6
7
8
9
bmbstats(
  data,
  SESOI_lower_function = function(data, na.rm, init_boot) {     return(0) },
  SESOI_upper_function = function(data, na.rm, init_boot) {     return(0) },
  estimator_function = function(data, SESOI_lower, SESOI_upper, na.rm, init_boot) {    
    return(0) },
  control = model_control(),
  na.rm = FALSE
)

Arguments

data

Data frame

SESOI_lower_function

Function to estimate SESOI_lower within bootstrap loop. Default functions is function(data, na.rm, init_boot) {return(0)}

SESOI_upper_function

Function to estimate SESOI_upper within bootstrap loop. Default functions is function(data, na.rm, init_boot) {return(0)}

estimator_function

Function to be used within the bootstrap loop to provide a list or named numeric vector of parameters. Default is function(data, SESOI_lower, SESOI_upper, na.rm, init_boot){return(0)}

control

Control object returned from model_control function. Use boot_type, boot_samples, boot_strata to setup bootstrap.

na.rm

Should missing values be removed? Default is FALSE. This is forwarded to estimator_function, SESOI_lower_function, and SESOI_upper_function

Value

A bmbstats object

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
bmbstats(iris,
  SESOI_lower_function = function(data, na.rm, init_boot) {
    sd(data$Sepal.Length) * -0.2
  },
  SESOI_upper_function = function(data, na.rm, init_boot) {
    sd(data$Sepal.Length) * 0.2
  },
  estimator_function = function(data, SESOI_lower, SESOI_upper, na.rm, init_boot) {
    list(mean = mean(data$Sepal.Length), SESOI_lower = SESOI_lower, SESOI_upper = SESOI_upper)
  },
  control = model_control(boot_type = "perc", boot_samples = 50)
)

mladenjovanovic/bmbstats documentation built on Aug. 5, 2020, 4:20 p.m.