I have generated a forecast with the tree-based method and now want to create a fable object. Therefore I created a tsibble object "fc_cart" (details at the end) with the predicted values (yhat) and bootstrapped residuals for the prediction intervals (boot).
I use the following statement to create the fable object:
fable_cart <- as_fable(fc_cart, response="yhat", distribution="boot")
And get the error:
Error in dimnames(fbl[[distribution]]) <- response :
'dimnames' applied to non-array
In addition: Warning message:
The dimnames of the fable's distribution are missing and have been set to match the response variables.
I have no idea what this mean.... Would be very grateful for any help!
> print(fc_cart,n=2)
# A tsibble: 365 x 3 [1D]
date yhat boot
<date> <dbl> <list>
1 2022-01-01 121. <dst_smpl[1d]>
2 2022-01-02 121. <dst_smpl[1d]>
# ℹ 363 more rows
The column boot was created with (to keep the snippet short here with rnorm; in my real implementation it is a bootstrap on the training residuals):
for (i in 1:nrow(fc_cart)) {
my_dist <- distributional::dist_sample(
list(
rnorm(1000)
)
)
fc_cart$boot[i] <- my_dist
}
fc_cart$boot <- distributional::dist_sample(lapply(1:nrow(fc_cart), function(...) rnorm(1000)))