predict.beset: Predict Methods for 'beset' Objects

View source: R/methods_predict.R

predict.besetR Documentation

Predict Methods for beset Objects

Description

Predict Methods for beset Objects

Usage

## S3 method for class 'beset'
predict(
  object,
  newdata,
  type = "response",
  newoffset = NULL,
  alpha = NULL,
  lambda = NULL,
  n_pred = NULL,
  metric = "auto",
  oneSE = TRUE,
  na.action = na.pass,
  tt = NULL,
  ...
)

Arguments

object

A beset_elnet object.

newdata

An optional data frame in which to look for variables with which to predict. If omitted, the fitted values are used.

type

Type of prediction required. Type "link" gives the linear predictors for "binomial" and "poisson" models; for "gaussian" models it gives the fitted values. Type "response" gives the fitted probabilities for "binomial", fitted mean for "poisson", and fitted values for "gaussian". Type "coefficients" computes the coefficients. Note that for "binomial" models, results are returned only for the class corresponding to the second level of the factor response. Type "class" applies only to "binomial" models, and produces the class label corresponding to the maximum probability. Type "nonzero" returns a list of the indices of the nonzero coefficients.

newoffset

If an offset is used in the fit, then one must be supplied for making predictions (except for type="coefficients" or type="nonzero")

alpha

(Optional) numeric value to force selection of elastic-net model with the given alpha parameter. If left NULL, the best value of alpha will be chosen using the cross-validation metric and oneSE rule.

lambda

(Optional) numeric value to force selection of elastic- net model with the given lambda parameter. If left NULL, the best value of lambda will be chosen using the cross-validation metric and oneSE rule.

n_pred

(Optional) integer number of predictors that the best model should contain. If specified, all other arguments are ignored.

metric

Character string giving prediction metric on which to base model selection. Can be one of "mce" (mean cross entropy–the default), "mse" (mean squared error), "aic" (Akaike informatio criterion, not applicable for elastic net), "auc" (area under the ROC curve–only applicable if response is binomial), or "mae" (mean absolute error–only applicable if response is numeric).

oneSE

Logical indicating whether or not to use the "one standard error" rule. If TRUE (default) the simplest model within one standard error of the optimal model is returned. If FALSE the model with the optimal cross-validation performance is returned.

na.action

function determining what should be done with missing values in newdata. The default is to predict NA.

...

further arguments passed to or from other methods.


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