Learn R Programming

UNCOVER (version 1.1.0)

predict.UNCOVER: Prediction method for UNCOVER

Description

Predicts the response of new observations and their cluster assignment using an object of class "UNCOVER".

Usage

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

Value

Either a data frame of response probabilities with cluster assignment for each observation or a data frame of predicted responses with cluster assignment for each observation.

Arguments

object

Object of class "UNCOVER"

newX

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

type

Either "prob" for a probabilistic response prediction 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 and so samples of the posterior, defined by "UNCOVER" object provided, will be obtained through SMC methods for prediction. See IBIS.logreg() for more details.

See Also

UNCOVER(), IBIS.logreg()

Examples

Run this code

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

# We can then run UNCOVER with no deforestation criteria
UN.none <- UNCOVER(X = CM,y = rv, deforest_criterion = "None", verbose = FALSE)

# The fitted values of UN.none can then be obtained
predict(UN.none)
predict(UN.none,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(UN.none,newX = CM.2))
# }

Run the code above in your browser using DataLab