Learn R Programming

SCE (version 1.1.0)

predict.SCA: Model Prediction and Simulation

Description

Functions for making predictions and performing simulations using trained SCA and SCE models. The package provides both S3 methods and direct function calls for various prediction scenarios.

Usage

# S3 method for SCA
predict(object, newdata, ...)

# S3 method for SCE predict(object, newdata, ...)

Model_simulation(model, Testing_data)

SCA_tree_predict(model, Testing_data)

SCE_Prediction(X_sample, model)

OOB_validation(model)

Value

For S3 methods:

  • predict.SCA(): A matrix of predicted values for the predictant variables

  • predict.SCE(): A list containing Training, Validation, and Testing predictions

For direct functions:

  • Model_simulation(): A list containing three components:

    • Training: Predictions for the training dataset

    • Validation: Out-of-bag (OOB) predictions

    • Testing: Predictions for the testing dataset

  • SCA_tree_predict(): A list containing predictions for the test data

  • SCE_Prediction(): A matrix containing ensemble predictions for each predictant

  • OOB_validation(): A data.frame containing OOB predictions for each predictant

Arguments

object

An object for which predictions should be made.

newdata

A data.frame or matrix containing new data for prediction. Must contain the same predictor variables as used in training.

model

A trained model object:

  • For Model_simulation: SCE model object (S3 class "SCE")

  • For SCA_tree_predict: SCA model object (S3 class "SCA")

  • For SCE_Prediction: SCE model object (S3 class "SCE")

  • For OOB_validation: SCE model object (S3 class "SCE")

Testing_data

A data.frame or matrix comprising the data that will be used to test the model. Must contain all the predictors used in the model. Must not contain missing values.

X_sample

A data.frame or matrix containing the predictor variables for which predictions are to be made. Must contain all predictors used in model training.

...

Additional arguments passed to methods.

Author

Kailong Li <lkl98509509@gmail.com>

Details

Prediction Methods:

  • predict.SCA(): S3 method for single SCA trees (calls SCA_tree_predict)

  • predict.SCE(): S3 method for SCE ensembles (calls Model_simulation)

  • Model_simulation(): Comprehensive simulation for SCE models with training, validation, and testing predictions

  • SCA_tree_predict(): Direct function for single SCA tree predictions

  • SCE_Prediction(): Direct function for SCE ensemble predictions

  • OOB_validation(): Internal function for calculating out-of-bag predictions

Prediction Process:

For SCA models:

  1. Input validation (data types, missing values, predictor matching)

  2. Data preparation (conversion to matrix format)

  3. Tree traversal and prediction using leaf node mappings

For SCE models:

  1. Input validation (data types, missing values, predictor matching)

  2. Data preparation (conversion to matrix format)

  3. Training predictions using all trees

  4. Out-of-bag predictions using trees not trained on each sample

  5. Testing predictions using all trees

  6. Weighting predictions based on tree weights

Out-of-Bag (OOB) Validation:

  • OOB predictions are made using only trees that did not use a particular observation during training

  • Provides unbiased estimate of model performance

  • Used internally by Model_simulation for validation predictions

Input Validation: All functions perform comprehensive validation:

  1. Data type and structure checks (data.frame or matrix)

  2. Missing value checks

  3. Predictor matching with training data

  4. Numeric data validation

References

Li, Kailong, Guohe Huang, and Brian Baetz. "Development of a Wilks feature importance method with improved variable rankings for supporting hydrological inference and modelling." Hydrology and Earth System Sciences 25.9 (2021): 4947-4966.

See Also

SCA, SCE