# curveopt: Optimise curve parameters In curvir: Specify Reserve Demand Curves

 curveopt R Documentation

## Optimise curve parameters

### Description

Finds optimal curve parameters.

### Usage

``````curveopt(
x,
y,
type = "logistic",
constant = c(TRUE, FALSE),
reps = 3,
sign = NULL,
q = NULL,
winit = NULL,
yhat = NULL,
wsel = c("select", "combine"),
dummy = NULL,
sameSign = c(TRUE, FALSE)
)
``````

### 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 `logistic`, `redLogistic`, `fixLogistic`, `doubleExp`, `exponential`, `fixExponential`, `arctan`, `linear`. See details in `curve` `constant` A logical (`TRUE` or `FALSE`) whether to include a constant or not. `reps` Number of repetitions for the particle swarm optimisation. `sign` A vector of equal length to the number of additional regressors in `x` (excluding the constant (if used) and the excess reserves) of positive and negative values (any) that will be used to obtain signs to restrict the values of the estimated parameters. Use `NULL` for no restrictions. `q` The desired quantile to optimise for. Use `NULL` to get the conditional expectation. `winit` A vector of initial values for the optimisation. This will also carry over to sign restrictions if `sameSign==TRUE`. `yhat` Useful when estimating quantiles. Supply here the predicted values for the conditional expectation to add restrictions for the quantiles to not cross the conditional expectation. Use `NULL` to not add any restrictions. `wsel` Use the minimum error set of parameters (`select`) or the combination of the pool parameters using the heuristic in Kourentzes et al., (2019) (`combine`). `dummy` Optional input to signify a regime change (vertical shifts in the curve). Must be a vector of equal length to the rows of `x`. If not needed use `NULL`. `sameSign` Used if `winit != NULL` to take any sign restrictions from `winit`.

### Value

Returns a list of

• `w` The optimal parameters

• `mse` The Mean Squared Error of the fitted curve.

### 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).

• Kourentzes, N., Barrow, D., & Petropoulos, F. (2019). Another look at forecast selection and combination: Evidence from forecast pooling. International Journal of Production Economics, 209, 226-235.

`curve`, and `curvepred`.

### Examples

``````

# Use ECB example data
rate <- ecb\$rate
x <- ecb\$x[,1,drop=FALSE]
curveopt(x,rate)

``````

curvir documentation built on Nov. 24, 2023, 5:09 p.m.