Skip to content

Bias correction of seasonal forecasts

miturbide edited this page Jun 20, 2018 · 10 revisions

The goal of this practice is to apply and analyze the bias correction techniques shown in the previous demonstration to calibrate the direct output of the seasonal forecasting.

Data

We will bias correct the seasonal forecasting data from 9 models of CFS using as reference the E-OBS gridded observation data. The train period considered is 1983-2001 (observed period) and the test period is 2002 (non-observed period). Here we use the mean temperature for the winter season.

# observation
data(EOBS_Iberia_tas)
y <- subsetGrid(EOBS_Iberia_tas, years = 1983:2001)

# predictor
data(CFS_Iberia_tas)
x <- subsetGrid(CFS_Iberia_tas, years = 1983:2001)

# predictor in the test period
newdata <- subsetGrid(CFS_Iberia_tas, years = 2002)
library(visualizeR)
spatialPlot(climatology(y, clim.fun = list(FUN = mean, na.rm = T)), 
                backdrop.theme = "countries", 
                scales = list(draw = T))

Function spatialPlot let us to draw all the members of CFS data in the same figure.

spatialPlot(climatology(x, clim.fun = list(FUN = mean, na.rm = T)), 
                backdrop.theme = "countries", 
                scales = list(draw = T))

Bias correction applied to a observed period

Next the "eqm" method of bias correction is applied using the function biasCorrection in downscaleR. In this particular example we illustrate an in-sample calibration approach (i.e., the bias correction parameters are estimated with all available data). Other approaches to account for the sampling error in these estimates may incorporate out-of-sample calibration. Note that out-of-sample strategies will be less prone to generate artificial skill due to overfitting. The definition of different periods for calibration and simulation can be specified through the arguments 'x' and 'newdata' respectively, that in this example (in-sample calibration) correspond to the same object. The consideration of the joint distribution of all members (important to preserve the multimember spread) is indicated through the argument multi.member = TRUE.

cal <- biasCorrection(y = y,
                      x = x,
                      newdata = x,
                      method = "eqm")

Once we have calibrated the simulation for the test period, we can validate the result against the observational reference. This can be easily done for a selected location with function quickDiagnostics, that returns two graphs. The first shows time-series of the original simulation (red), the calibrated simulation (blue) and the observation (black). The second graph is the quantile-quantile plot, that better illustrates the effect of the applied method.

loc <- c(-5, 42)
quickDiagnostics(y, x, cal, location = loc)

We can also plot the different CFS members.

spatialPlot(climatology(cal))

Bias correction applied to a non-observed period

This is a tercile plot (type ?tercilePlot) that performs the mean of all stations and shows the skill (ROCSS) of the seasonal forecasting models:

tercilePlot(CFS_Iberia_tas, obs = EOBS_Iberia_tas, year.target = 2002, color.pal = "ypb")

Next the "eqm" and "scaling" methods of bias correction are applied, to bias correct out-of-sample data (newdata, year 2002).

# In the case of the temperature these are two of the bias correction methods available:
cal1 <- biasCorrection(y = y,
                      x = x,
                      newdata = newdata, 
                      method = "scaling",
                      scaling.type = "multiplicative")
cal2 <- biasCorrection(y = y,
                      x = x,
                      newdata = newdata,
                      method = "eqm")

In order to show the spread of the spatial mean of the ensemble and the effect of the correction we can use function temporalPlot.

Next we plot the data used for calibration and also the out-of-sample series (corrected with the "scaling" method and non-corrected):

temporalPlot(y, x, newdata, cal1, cols = c("black", "red", "red", "blue"))

To see the effect of the correction in detail, next we only plot year 2002:

temporalPlot(newdata, cal1, cols = c("red", "blue"))

Finally, next we generate a similar plot to compare both bias correction methods. Here we can see that the "eqm" method results in less multi-member variability:

temporalPlot(cal1, cal2, cols = c("blue", "green"))


<-- Home page of the Wiki

Session info

print(sessionInfo(package = c("transformeR", "downscaleR")))

## R version 3.4.3 (2017-11-30)
## Platform: x86_64-pc-linux-gnu (64-bit)
## Running under: Ubuntu 14.04.5 LTS
## 
## Matrix products: default
## BLAS: /usr/lib/libblas/libblas.so.3.0
## LAPACK: /usr/lib/lapack/liblapack.so.3.0
## 
## locale:
##  [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C              
##  [3] LC_TIME=es_ES.UTF-8        LC_COLLATE=en_US.UTF-8    
##  [5] LC_MONETARY=es_ES.UTF-8    LC_MESSAGES=en_US.UTF-8   
##  [7] LC_PAPER=es_ES.UTF-8       LC_NAME=C                 
##  [9] LC_ADDRESS=C               LC_TELEPHONE=C            
## [11] LC_MEASUREMENT=es_ES.UTF-8 LC_IDENTIFICATION=C       
## 
## attached base packages:
## character(0)
## 
## other attached packages:
## [1] transformeR_1.3.3 downscaleR_3.0.0 
## 
## loaded via a namespace (and not attached):
##  [1] Rcpp_0.12.15        compiler_3.4.3      highr_0.6          
##  [4] methods_3.4.3       bitops_1.0-6        iterators_1.0.8    
##  [7] utils_3.4.3         tools_3.4.3         grDevices_3.4.3    
## [10] deepnet_0.2         digest_0.6.13       dotCall64_0.9-5.2  
## [13] evd_2.3-2           gtable_0.2.0        evaluate_0.10.1    
## [16] lattice_0.20-35     Matrix_1.2-7.1      foreach_1.4.3      
## [19] yaml_2.1.16         parallel_3.4.3      spam_2.1-2         
## [22] akima_0.6-2         gridExtra_2.2.1     stringr_1.2.0      
## [25] knitr_1.18          raster_2.6-7        gridGraphics_0.2   
## [28] graphics_3.4.3      datasets_3.4.3      stats_3.4.3        
## [31] fields_9.6          maps_3.2.0          rprojroot_1.3-2    
## [34] grid_3.4.3          glmnet_2.0-13       base_3.4.3         
## [37] rmarkdown_1.8       sp_1.2-7            magrittr_1.5       
## [40] backports_1.1.2     codetools_0.2-15    htmltools_0.3.6    
## [43] MASS_7.3-44         abind_1.4-5         stringi_1.1.5      
## [46] RCurl_1.95-4.10     RcppEigen_0.3.3.3.1
Clone this wiki locally