optimal_s0: Select the Optimal Model from Each Simulation

View source: R/optimal_s0.R

optimal_s0R Documentation

Select the Optimal Model from Each Simulation

Description

For a set of simulations that used multiple spike scale parameters this function selects the optimal model based on user-selected criteria and creates a new data frame of statistics for the optimal models. If desired, outputs summaries from the new data frame.

Usage

optimal_s0(
  sim.data,
  criteria,
  tie.breaker = "min",
  print.details = FALSE,
  suppress.warnings = FALSE
)

Arguments

sim.data

A data frame containing simulation results. The data is intended to be generated from stacking multiple compare_ssnet() outputs in a single data frame.

criteria

Specifies the criteria for model selection. Options are "deviance", "mse", "mae" for deviance, mean-square error, and mean absolute error, respectively. When family = "binomial", additional options are "auc" and "misclassification", for Area under the ROC curve and the percentage of cases where the difference between the observed and predicted values is greater than 1/2.

tie.breaker

This argument decides how to break ties when multiple values of spike scale minimize criteria. The default is "min", which selects the smallest spike scale that minimizes criteria; alternatively, "max", which selects the largest spike scale that minimizes criteria.

print.details

Logical. Determines whether to print periodic output.

suppress.warnings

Logical. When TRUE suppresses warning output. Default is FALSE.

Value

A data frame containing where each row is an optimal model from a set of models.

Examples

sdt <- data.frame(model = rep("mystery", 12),
                  s0 = rep(c(0.01, 0.02, 0.03), 4),
                  deviance = c(-0.17267380, -0.00398748, 0.49164019,
                               -0.19134208, 0.05202775, -0.76916548,
                               0.08757465, -0.73574828, -0.64348907,
                               -0.46910645, -0.56955834, -1.54488900))
optimal_s0(sdt, criteria = "deviance")


jmleach-bst/ssnet documentation built on March 4, 2024, 5:04 p.m.