Predictions from an Inbagg Object
predict.inbagg.RdPredicts the class membership of new observations through indirect bagging.
Usage
# S3 method for class 'inbagg'
predict(object, newdata, ...)Arguments
- object
object of class
inbagg, seeinbagg.- newdata
data frame to be classified.
- ...
additional argumends corresponding to the predictive models.
Details
Predictions of class memberships are calculated. i.e. values of the
intermediate variables are predicted following pFUN and classified following cFUN,
see inbagg.
References
David J. Hand, Hua Gui Li, Niall M. Adams (2001), Supervised classification with structured class definitions. Computational Statistics & Data Analysis 36, 209–225.
Andrea Peters, Berthold Lausen, Georg Michelson and Olaf Gefeller (2003), Diagnosis of glaucoma by indirect classifiers. Methods of Information in Medicine 1, 99-103.
Examples
library("MASS")
library("rpart")
y <- as.factor(sample(1:2, 100, replace = TRUE))
W <- mvrnorm(n = 200, mu = rep(0, 3), Sigma = diag(3))
X <- mvrnorm(n = 200, mu = rep(2, 3), Sigma = diag(3))
colnames(W) <- c("w1", "w2", "w3")
colnames(X) <- c("x1", "x2", "x3")
DATA <- data.frame(y, W, X)
pFUN <- list(list(formula = w1~x1+x2, model = lm),
list(model = rpart))
RES <- inbagg(y~w1+w2+w3~x1+x2+x3, data = DATA, pFUN = pFUN)
predict(RES, newdata = X)
#> [1] 1 2 1 1 2 1 1 1 1 1 1 1 1 2 1 1 2 1 2 2 2 1 2 1 2 2 1 1 1 1 1 1 2 1 2 2 2
#> [38] 2 1 1 2 2 1 2 2 2 2 1 1 2 2 2 1 1 2 2 1 2 2 1 1 2 2 2 2 2 2 1 2 2 1 2 2 2
#> [75] 2 1 2 2 1 2 1 1 2 2 1 1 2 1 1 2 2 1 1 2 1 1 2 1 1 1 1 2 2 1 2 1 1 1 1 1 1
#> [112] 1 1 2 1 1 2 1 2 2 2 1 2 1 2 2 1 1 1 1 1 1 2 1 2 2 2 2 1 1 2 2 1 2 2 2 1 1
#> [149] 1 2 2 2 1 1 2 2 1 2 2 1 1 2 2 2 2 2 2 1 2 2 1 2 2 2 2 1 2 2 1 2 1 1 2 2 1
#> [186] 1 2 1 1 2 1 1 1 2 1 1 2 1 1 1
#> Levels: 1 2