Closed matteodefelice closed 6 years ago
Thanks for reporting! As you said, there was a bug when applying the "delta" method and CV. The error was due to the particularity of the "delta" correction, that is applied in the following general manner (when cross.val = "none"): y + (mean(newdata) - mean(x))
thus the resulting object has the same time dimension as the observation data (y).
When cross.val = "loocv"/"kfold", this formula is applied as many times as number of data partitions are defined for test (number of years/folds): y[train years/folds] + (mean(x[test year/fold]) - mean(x[train years/folds])),
thus, the time dimension = numberOf_years/folds * daysInEach_train_year/fold).
We have made some changes at this respect. Now, when applying the "delta" method in CV, a subset of "y" is done to get the same time series of the test data (daily series of 1 year for "loocv" or daily series of 1 fold for "kfold"). The "delta" method is now applied in this particular manner when cross.val != "none":
y[test year/fold] + (mean(x[test year/fold]) - mean(x[train years/folds])),
Thus, the binding of the outputs corresponding to all years/folds gives the correct time dimension.
When are you going to release a new master version? Or can I switch to the devel
branch?
Hi Matteo, we are about to move to downscaleR 2.0-0. The data transformation/manipulation tools have been moved to transformeR, which becomes now a dependency for downscaleR. We have still to update all the documentation, but this is ready for testing, so you can switch to the devel version now. Your feedback will be welcome!.
devtools::install_github(c("SantanderMetGroup/transformeR",
"SantanderMetGroup/downscaleR@devel"))
Here, I have an observational dataset (obs) and a forecast (fcst).
When I apply a
delta
bias correction with the command:I got a grid with a wrong time dimension:
This is not happening with other bias correction methods! It seems a bug due to CV, in fact without it, it works fine.