predict.nb: Predict method for the nb function

predict.nbR Documentation

Predict method for the nb function

Description

Predict method for the nb function

Usage

## S3 method for class 'nb'
predict(
  object,
  pred_data = NULL,
  pred_cmd = "",
  pred_names = "",
  dec = 3,
  envir = parent.frame(),
  ...
)

Arguments

object

Return value from nb

pred_data

Provide the dataframe to generate predictions (e.g., titanic). The dataset must contain all columns used in the estimation

pred_cmd

Generate predictions using a command. For example, ‘pclass = levels(pclass)' would produce predictions for the different levels of factor 'pclass'. To add another variable, create a vector of prediction strings, (e.g., c(’pclass = levels(pclass)', 'age = seq(0,100,20)')

pred_names

Names for the predictions to be stored. If one name is provided, only the first column of predictions is stored. If empty, the level in the response variable of the nb model will be used

dec

Number of decimals to show

envir

Environment to extract data from

...

further arguments passed to or from other methods

Details

See https://radiant-rstats.github.io/docs/model/nb.html for an example in Radiant

See Also

nb to generate the result

summary.nb to summarize results

Examples

result <- nb(titanic, "survived", c("pclass", "sex", "age"))
predict(result, pred_data = titanic)
predict(result, pred_data = titanic, pred_names = c("Yes", "No"))
predict(result, pred_cmd = "pclass = levels(pclass)")
result <- nb(titanic, "pclass", c("survived", "sex", "age"))
predict(result, pred_data = titanic)
predict(result, pred_data = titanic, pred_names = c("1st", "2nd", "3rd"))
predict(result, pred_data = titanic, pred_names = "")


radiant-rstats/radiant.model documentation built on Nov. 29, 2023, 5:59 a.m.