Predicts the response for the training data using only the trees in the SDForest that were not trained on the observation.

predictOOB(object, X = NULL)

Arguments

object

Fitted object of class SDForest.

X

Covariates of the training data. If NULL, the data saved in the object is used.

Value

A vector of out-of-bag predictions for the training data.

Author

Markus Ulmer

Examples

set.seed(1)
n <- 50
X <- matrix(rnorm(n * 5), nrow = n)
y <- sign(X[, 1]) * 3 + rnorm(n)
model <- SDForest(x = X, y = y, Q_type = 'no_deconfounding', nTree = 5, cp = 0.5)
predictOOB(model)
#>  [1]         NA  1.1864663  1.0083529  2.4420805  0.2082149 -1.3387076
#>  [7]  0.6082839  0.1959390  0.1959390 -0.3652118  2.1671839  0.4667436
#> [13]         NA  0.1959390  3.1503676 -0.9154959  0.2082149  2.1753679
#> [19]  1.4556451  2.0879370  3.1503676  0.1836630         NA -1.5640233
#> [25]  1.1807485  0.5960080 -2.8610782  0.2082149 -1.8307360  0.6082839
#> [31]  0.2082149  0.1959390  2.0793603  1.0083529  0.1959390  1.0083529
#> [37] -1.8389200 -0.9263626  1.1807485  3.1503676 -1.3271362 -1.8307360
#> [43]  1.4613630  0.1836630 -0.3652118 -0.9154959  2.0879370         NA
#> [49]         NA  0.6082839