predict.UNCOVER {UNCOVER} | R Documentation |
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 class 'UNCOVER'
predict(object, newX = NULL, type = "prob", ...)
Arguments
object |
Object of class |
newX |
Data frame containing new observations to predict. If not specified the fitted values will be returned instead. |
type |
Either |
... |
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.
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.
See Also
Examples
# 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))