Learn R Programming

nestedcv (version 0.9.0)

predict.hsstan: Predict from hsstan model fitted within cross-validation

Description

Draws from the posterior predictive distribution of the outcome.

Usage

# S3 method for hsstan
predict(object, newdata = NULL, type = NULL, ...)

Value

For a binary outcome and type = NULL, a character vector with the name of the class that has the highest probability for each sample. For a binary outcome and type = prob, a 2-dimensional matrix with the probability of class 0 and of class 1 for each sample. For a continuous outcome a numeric vector with the predicted value for each sample.

Arguments

object

An object of class hsstan.

newdata

Optional data frame containing the variables to use to predict. If NULL (default), the model matrix is used. If specified, its continuous variables should be standardized, since the model coefficients are learnt on standardized data.

type

Option for binary outcomes only. Default NULL will return a class with the highest probability for each sample. If set to probs, it will return the probabilities for outcome = 0 and for outcome = 1 for each sample.

...

Optional arguments passed to hsstan::posterior_predict

Author

Athina Spiliopoulou