predict.nb: Predict method for the nb function

Description Usage Arguments Details See Also Examples

View source: R/nb.R

Description

Predict method for the nb function

Usage

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

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

...

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

1
2
3
4
5
6
7
8
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. 13, 2018, 7 a.m.