varselect {curvir} | R Documentation |
Automatically select explanatory variables for a curve type
Description
Using cross-validation automatically select explanatory variables for a reserve demand curve type.
Usage
varselect(
x,
y,
type = "logistic",
folds = 10,
constant = c(TRUE, FALSE),
sign = NULL,
reps = 3,
search = c("backward", "forward"),
wsel = c("select", "combine"),
dummy = NULL
)
Arguments
x |
A matrix of explanatory variables. Excess reserve must be the first input.Additional regressor follow (optional). |
y |
A vector of normalised interest rates. |
type |
The type of the reserve demand curve. This can be any of |
folds |
Folds to use for cross-validation. |
constant |
A logical ( |
sign |
A vector of equal length to the number of additional regressors in |
reps |
Number of repetitions for the particle swarm optimisation. |
search |
Search strategy for variable inclusion. With |
wsel |
Use the minimum error set of parameters ( |
dummy |
Optional input to signify a regime change (vertical shifts in the curve). Must be a vector of equal length to the rows of |
Value
Returns a list with the recommended variable selection choice:
-
keep
a logical vector with which variables to keep. -
errors
statistics of the cross-validated MSE error.
Author(s)
Nikolaos Kourentzes, nikolaos@kourentzes.com
References
Chen, Z., Kourentzes, N., & Veyrune, R. (2023). Modeling the Reserve Demand to Facilitate Central Bank Operations. IMF Working Papers, 2023(179).
See Also
Examples
# Use ECB example data
rate <- ecb$rate
x <- ecb$x[,1:3,drop=FALSE]
varKeep <- varselect(x,rate,folds=5)
# Print result
print(varKeep)
# Fit curve with the selected variables
curve(x[,varKeep$keep,drop=FALSE],rate)