Predict values using a fitted cv.hfr model
Usage
# S3 method for cv.hfr
predict(object, newdata = NULL, kappa = NULL, ...)Arguments
- object
Fitted 'cv.hfr' model.
- newdata
Matrix or data.frame of new values for
xat which predictions are to be made.- kappa
The hyperparameter used for prediction. If empty, the optimal value is used.
- ...
additional methods passed to
predict.
Details
Predictions are made by multiplying the newdata object with the estimated coefficients.
The chosen hyperparameter value to use for predictions can be passed to
the kappa argument.
Examples
x = matrix(rnorm(100 * 20), 100, 20)
y = rnorm(100)
fit = cv.hfr(x, y, kappa = seq(0, 1, by = 0.1))
predict(fit, kappa = 0.1)
#> [1] -0.194219125 -0.199702053 0.119090312 -0.484572892 0.253596205
#> [6] -0.172225798 -0.055314747 0.088128398 0.028824387 -0.161778861
#> [11] 0.233032011 0.277511469 0.273501924 -0.182696803 -0.004569667
#> [16] 0.426355741 -0.224583396 -0.048418804 -0.369440448 0.106875858
#> [21] 0.062528652 0.113522305 0.048721289 0.017830340 -0.710026725
#> [26] -0.700652933 -0.060455748 -0.412104730 0.132245083 -0.255587315
#> [31] 0.092733731 0.272026897 -0.004281673 -0.026521481 0.167038956
#> [36] 0.075078164 0.367985865 -0.103911380 0.455173700 -0.082462860
#> [41] -0.249820781 0.238452387 0.248208528 -0.060925247 -0.413087819
#> [46] 0.069859617 0.483813889 0.642164414 0.012559837 0.291708200
#> [51] -0.270067614 -0.502883419 -0.050379331 -0.099787863 0.913874513
#> [56] 0.094419501 -0.183000320 0.071755822 -0.499059077 -0.719858041
#> [61] 0.469678113 -0.164804356 -0.437400928 -0.276882648 0.390771921
#> [66] -0.117447385 0.053239121 -0.072746076 -0.446190643 -0.443314289
#> [71] -0.217523417 0.064201484 -0.443802594 -0.377429730 0.564939264
#> [76] 0.482241922 0.061608368 -0.093010721 0.098298305 -0.050459062
#> [81] 0.369420077 -0.153003311 0.330331361 -0.200080260 -0.623773683
#> [86] 0.631202046 -0.133722338 0.062820799 -0.405317164 -0.354616819
#> [91] 0.581267042 -0.371552179 0.005377686 -0.276853221 0.453869691
#> [96] -0.674188811 0.589647686 0.301454394 0.036720326 0.151421097