Learn R Programming

UNCOVER (version 1.1.0)

predict.IBIS: Prediction method for IBIS

Description

Predicts the response of new observations using an object of class "IBIS".

Usage

# S3 method for IBIS
predict(object, newX = NULL, type = "prob", ...)

Value

Either a matrix of response probabilities for each observation or a vector of predicted responses for each observation.

Arguments

object

Object of class "IBIS"

newX

Data frame containing new observations to predict. If not specified the fitted values will be returned instead.

type

Either "prob" for a probabilistic output or "response" for a hard output of the predicted response

...

Additional arguments affecting the predictions produced

Details

Note that this is a Bayesian prediction method as objects with class "IBIS" will provide samples from a posterior.

See Also

IBIS.logreg()

Examples

Run this code

# \donttest{
# First we generate a co-variate matrix X and binary response vector y
CM <- data.frame(X1 = rnorm(100),X2 = rnorm(100))
rv <- sample(0:1,100,replace=TRUE)

# Now we can obtain 1000 samples from the posterior from a standard
# multivariate normal prior
out <- IBIS.logreg(X = CM,y = rv)

# The fitted values of out can be obtained
predict(out)
predict(out,type = "response")

# We can also predict the response for new data
CM.2 <- data.frame(X1 = rnorm(10),X2 = rnorm(10))
cbind(CM.2,predict(out,newX = CM.2))
# }

Run the code above in your browser using DataLab