cv.bh3: Cross Validation for Bayesian Models or Elastic Net

View source: R/cv_bh3.R

cv.bh3R Documentation

Cross Validation for Bayesian Models or Elastic Net

Description

Several alterations to cv.bh() were necessary to ensure that update() works in the functions compare_ssnet(). Many arguments and functionality are the same as cv.bh(). See cv.bh for details. An addition in this version is also that for binary outcomes classification and observed accuracy, sensitivity, specificity, and positive and negative predictive values can be output as well as the orginally included measures.

Usage

cv.bh3(
  object,
  nfolds = 10,
  foldid = NULL,
  fold.seed = NULL,
  ncv = 1,
  verbose = TRUE,
  classify = FALSE,
  classify.rule = 0.5
)

Arguments

object

a fitted object.

nfolds

number of folds(groups) into which the data should be split to estimate the cross-validation prediction error. default is 10. Although nfolds can be as large as the sample size (leave-one-out CV), it is not recommended for large datasets.

foldid

an optional vector (if ncv = 1) or matrix (if ncv > 1) of values between 1 and nfolds identifying what fold each observation is in. If supplied, nfolds can be missing.If foldid = NULL, nfolds subsets will be generated randomly.

fold.seed

An integer that sets the seed for generating folds.

ncv

repeated number of cross-validation.

verbose

logical. If TRUE, print out computational time and progress.

classify

Logical. When TRUE and family = "binomial" applies a classification rule given by the argument classify.rule, and outputs accuracy, sensitivity, specificity, positive predictive value (ppv), and negative predictive value (npv).

classify.rule

A value between 0 and 1. For a given predicted value from a logistic regression, if the value is above classify.rule, then the predicted class is 1; otherwise the predicted class is 0. The default is 0.5.

Note

The package pROC will not calculate the AUC when a fold does does not have at least one observation of each level. This can largely be avoided by selecting the number of folds so that such circumstances are rare. When such does occur, the current result is to assign AUC <- NA. Note that during cross validation, the initialization values for the algorithm to re-fit the model are the initial estimates for the object. This follows cv.bh.


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