Predicts the response for new data using a fitted SDAM.

# S3 method for class 'SDAM'
predict(object, newdata, ...)

Arguments

object

Fitted object of class SDAM.

newdata

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

...

Further arguments passed to or from other methods.

Value

A vector of predictions for the new data.

See also

Author

Cyrill Scheidegger

Examples

set.seed(1)
X <- matrix(rnorm(10 * 5), ncol = 5)
Y <- sin(X[, 1]) -  X[, 2] + rnorm(10)
model <- SDAM(x = X, y = Y, Q_type = "trim", trim_quantile = 0.5, nfold = 2, n_K = 1)
#> [1] "Initial cross-validation"
#> [1] "Second stage cross-validation"
predict(model, newdata = data.frame(X))
#>  [1] -0.02222175 -0.02222175 -0.02222175 -0.02222175 -0.02222175 -0.02222175
#>  [7] -0.02222175 -0.02222175 -0.02222175 -0.02222175