predict.nb | R Documentation |
Predict method for the nb function
## S3 method for class 'nb'
predict(
object,
pred_data = NULL,
pred_cmd = "",
pred_names = "",
dec = 3,
envir = parent.frame(),
...
)
object |
Return value from |
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 |
See https://radiant-rstats.github.io/docs/model/nb.html for an example in Radiant
nb
to generate the result
summary.nb
to summarize results
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 = "")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.