# \donttest{
# # This example is computationally intensive and may take a long time to run.
# # It is recommended to run this example on a machine with a high-performance CPU.
#
# ## Load SCE package and the supporting packages
# library(SCE)
# library(parallel)
#
# data(Streamflow_training_22var)
# data(Streamflow_testing_22var)
#
# # Define predictors and predictants
# Predictors <- c(
# "Precipitation", "Radiation", "Tmax", "Tmin", "VP",
# "Precipitation_2Mon", "Radiation_2Mon", "Tmax_2Mon", "Tmin_2Mon", "VP_2Mon",
# "PNA", "Nino3.4", "IPO", "PDO",
# "PNA_lag1", "Nino3.4_lag1", "IPO_lag1", "PDO_lag1",
# "PNA_lag2", "Nino3.4_lag2", "IPO_lag2", "PDO_lag2"
# )
# Predictants <- c("Flow")
#
# # Perform RFE
# set.seed(123)
# result <- RFE_SCE(
# Training_data = Streamflow_training_22var,
# Testing_data = Streamflow_testing_22var,
# Predictors = Predictors,
# Predictant = Predictants,
# Nmin = 5,
# Ntree = 48,
# alpha = 0.05,
# resolution = 1000,
# step = 3, # Number of predictors to remove at each iteration
# verbose = TRUE,
# parallel = TRUE
# )
#
# ## Access results
# summary <- result$summary
# performances <- result$performances
# importance_scores <- result$importance_scores
#
# ## Plot RFE results
# Plot_RFE(result)
#
# ## Customized plot
# Plot_RFE(result,
# main = "My RFE Results",
# col_validation = "darkblue",
# col_testing = "darkred",
# lwd = 3,
# cex = 1.5)
#
# ## Note: The RFE_SCE function internally uses S3 methods for SCE models
# ## including importance() and evaluate() for model analysis
#
# # }
Run the code above in your browser using DataLab