Predicts the response for new data using a fitted SDForest.

# S3 method for class 'SDForest'
predict(object, newdata, mc.cores = 1, verbose = FALSE, ...)

Arguments

object

Fitted object of class SDForest.

newdata

New test data of class data.frame containing the covariates for which to predict the response.

mc.cores

Number of cores to use for parallel computation `vignette("Runtime")`. The `future` package is used for parallel processing. To use custom processing plans mc.cores has to be <= 1, see [`future` package](https://future.futureverse.org/).

verbose

If TRUE progress updates are shown using the `progressr` package. To customize the progress bar, see [`progressr` package](https://progressr.futureverse.org/articles/progressr-intro.html)

...

Further arguments passed to or from other methods.

Value

A vector of predictions for the new data.

See also

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)
predict(model, newdata = data.frame(X))
#>      value      value      value      value      value      value      value 
#> -0.8600384  1.5436239 -0.8600384  1.5436239  1.5436239 -0.8600384  1.5436239 
#>      value      value      value      value      value      value      value 
#>  1.5436239  1.5436239 -0.8600384  1.5436239  1.5436239 -0.8600384 -0.8600384 
#>      value      value      value      value      value      value      value 
#>  1.5436239 -0.8600384 -0.8600384  1.5436239  1.5436239  1.5436239  1.5436239 
#>      value      value      value      value      value      value      value 
#>  1.5436239  1.5436239 -0.8600384  1.5436239 -0.8600384 -0.8600384 -0.8600384 
#>      value      value      value      value      value      value      value 
#> -0.8600384  1.5436239  1.5436239 -0.8600384  1.5436239 -0.8600384 -0.8600384 
#>      value      value      value      value      value      value      value 
#> -0.8600384 -0.8600384 -0.8600384  1.5436239  1.5436239 -0.8600384 -0.8600384 
#>      value      value      value      value      value      value      value 
#>  1.5436239  1.5436239 -0.8600384 -0.8600384  1.5436239  1.5436239 -0.8600384 
#>      value 
#>  1.5436239