Learn R Programming

radiant.model (version 0.8.0)

predict.nb: Predict method for the nb function

Description

Predict method for the nb function

Usage

# S3 method for nb
predict(object, pred_data = "", pred_cmd = "",
  pred_names = "", dec = 3, ...)

Arguments

object

Return value from nb

pred_data

Provide the name of a 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 use a `,` (e.g., `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

...

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

Run this code
# NOT RUN {
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 = "")
predict(result, pred_data = "titanic", pred_names = NA)

# }

Run the code above in your browser using DataLab