svmroc: SVM ROC curves

Description Usage Arguments Value

View source: R/svmroc.R

Description

svmroc fits a weighted support vector machine to estimate a receiver operating characteristic curve.

Usage

1
2
3
svmroc(X, A, new_X, new_A, kernel = "linear", lambdas = c(0.5, 2, 4, 8, 12,
  16), sigmas = c(0.05, 0.1, 0.5, 1, 2), num_folds = 5,
  weights = seq(0.01, 0.99, 0.01), seed = NULL)

Arguments

X

A matrix of covariates used for fitting the SVM.

A

A factor with two levels or an object that can be coerced to a factor with two levels; used as the response when fitting the SVM.

new_X

A matrix of covariates used as the testing set for estimating the ROC curve.

new_A

A factor with two levels or an object that can be coerced to a factor with two levels; used as the response for the testing set for estimating the ROC curve. Must have the same levels as Y.

kernel

The kernel used for fitting the SVM, either "linear" or "Gaussian". Defaults to "linear".

lambdas

A numeric vector of penalty parameters to select from. Defaults to c(0.5, 1, 2, 4, 8).

sigmas

A numeric vector of bandwidth parameters to select from. Defaults to c(0.05, 0.1, 0.5, 1, 2).

num_folds

Number of folds for cross-validation to select tuning parameters. Defaults to 5.

weights

A vector of weights to use for the weighted SVM. Defaults to seq(0.01, 0.99, 0.01).

seed

Random number seed to set. If NULL, no seed is set. Defaults to NULL.

Value

An object of class svmroc, a list with the following components: sens, estimated sensitivities across weights; spec, estimated specificities across weights; models, a list of models fit for each weight; weights, the vector of weights used in the fit; new_X, the matrix of covariates in the testing set; and new_Y, the responses in the testing set.


djluckett/svmroc documentation built on Oct. 6, 2019, 12:42 a.m.