****
The cointegration based support vector regression model
is a combination of error correction model and support vector regression
(https://doi.org/10.1007/s40009-026-02355-9). This hybrid
model allows the researcher to make use of the information extracted by
the cointegrating vector as an input in the support vector regression
model.
****
# Examples: How The cointegration based support vector regression model can be applied
library(ECTSVR)
#> Registered S3 method overwritten by 'quantmod':
#> method from
#> as.zoo.data.frame zoo
## Generate sample data
set.seed(123)
n <- 100
oil <- cumsum(rnorm(n, 0, 1)) + 50
fruit <- 2 * oil + rnorm(n, 0, 1) + 100
# Run analysis (quiet, no plots)
results <- run_ectsvr_analysis(fruit, oil, verbose = FALSE, plot_results = FALSE)
#> Warning in tseries::kpss.test(oil): p-value smaller than printed p-value
#> Warning in tseries::kpss.test(fruit): p-value smaller than printed p-value
# View best model
print(results$best_model)
#> Model Kernel Train_RMSE Train_MAE Train_MAPE Train_R2 Test_RMSE Test_MAE
#> 5 ECT-SVR linear 1.973626 1.534354 0.7535626 0.6664306 2.669452 2.027583
#> Test_MAPE Test_R2
#> 5 0.9535512 0.8666738