compare: Compare Predictive Performance of Two Models

View source: R/compare.R

compareR Documentation

Compare Predictive Performance of Two Models

Description

Compare Predictive Performance of Two Models

Usage

compare(
  yhat1,
  yhat2,
  n_rep = 1000,
  conf = 0.95,
  parallel_type = NULL,
  n_cores = NULL,
  cl = NULL,
  ...
)

## S3 method for class 'cross_valid'
compare(
  yhat1,
  yhat2,
  n_rep = 1000,
  conf = 0.95,
  parallel_type = NULL,
  n_cores = NULL,
  cl = NULL,
  ...
)

## S3 method for class 'numeric'
compare(
  yhat1,
  yhat2,
  n_rep = 1000,
  conf = 0.95,
  parallel_type = NULL,
  n_cores = NULL,
  cl = NULL,
  y,
  ...
)

## S3 method for class 'beset'
compare(
  yhat1,
  yhat2,
  n_rep = 1000,
  conf = 0.95,
  parallel_type = NULL,
  n_cores = NULL,
  cl = NULL,
  ...
)

## S3 method for class 'lm'
compare(
  yhat1,
  yhat2,
  n_rep = 1000,
  conf = 0.95,
  parallel_type = NULL,
  n_cores = NULL,
  cl = NULL,
  ...
)

## S3 method for class 'zeroinfl'
compare(yhat1, yhat2, ...)

Arguments

yhat1

A data frame consisting of cross-validated predictions from a benchmark model, an object containing such a data frame, e.g., a "cross_valid" object returned by validate, or an object that can be passed to validate.

yhat2

An object of the same type as yhat1 to be compared

n_rep

Integer giving the number of bootstrap replicates to perform for each repetition of cross-validated predictions. For example, if yhat1 and yhat2 contain 10 columns of predictions, the default value of n_rep = 1000 will result in 1000 \times 10 = 10,000 replicates total.

conf

Confidence level for the difference between model performance.

parallel_type

(Optional) character string indicating the type of parallel operation to be used, either "fork" or "sock". If omitted and n_cores > 1, the default is "sock" for Windows and otherwise either "fork" or "sock" depending on which process is being run.

n_cores

Integer value indicating the number of workers to run in parallel during subset search and cross-validation. By default, this will be set to one fewer than the maximum number of physical cores you have available, as indicated by detectCores. Set to 1 to disable parallel processing.

cl

(Optional) parallel or snow cluster for use if parallel_type = "sock". If not supplied, a cluster on the local machine is automatically created.

Methods (by class)

  • compare(cross_valid): S3 method for class 'cross_valid'

  • compare(numeric): S3 method for class 'numeric'

  • compare(beset): two 'beset' class models

  • compare(lm): two 'glm' or 'lm' class models

  • compare(zeroinfl): two 'zeroinfl' class models


jashu/beset documentation built on April 20, 2023, 5:28 a.m.