interpolation_cross_validation {meteoland} | R Documentation |
Calibration and validation of interpolation procedures
Description
Calibration and validation of interpolation procedures
Usage
interpolation_cross_validation(
interpolator,
stations = NULL,
verbose = getOption("meteoland_verbosity", TRUE)
)
interpolator_calibration(
interpolator,
stations = NULL,
update_interpolation_params = FALSE,
variable = "MinTemperature",
N_seq = seq(5, 30, by = 5),
alpha_seq = seq(0.25, 10, by = 0.25),
verbose = getOption("meteoland_verbosity", TRUE)
)
Arguments
interpolator |
A meteoland interpolator object, as created by
|
stations |
A vector with the stations (numeric for station indexes or
character for stations id) to be used to calculate |
verbose |
Logical indicating if the function must show messages and info.
Default value checks |
update_interpolation_params |
Logical indicating if the interpolator object must be updated with the calculated parameters. Default to FALSE |
variable |
A string indicating the meteorological variable for which
interpolation parameters
|
N_seq |
Numeric vector with |
alpha_seq |
Numeric vector with |
Details
Function interpolator_calibration
determines optimal interpolation
parameters "N"
and "alpha"
for a given meteorological
variable. Optimization is done by minimizing mean absolute error ("MAE")
(Thornton et al. 1997). Function
interpolation_cross_validation
calculates average mean absolute
errors ("MAE") for the prediction period of the interpolator object. In both
calibration and cross validation procedures, predictions for each
meteorological station are made using a leave-one-out procedure (i.e.
after excluding the station from the predictive set).
Value
interpolation_cross_validation
returns a list with the
following items
errors: Data frame with each combination of station and date with observed variables, predicated variables and the total error (predicted - observed) calculated for each variable
station_stats: Data frame with error and bias statistics aggregated by station
dates_stats: Data frame with error and bias statistics aggregated by date
r2: correlation indexes between observed and predicted values for each meteorological variable
If update_interpolation_params
is FALSE (default),
interpolator_calibration
returns a list with the following items
MAE: A numeric matrix with the mean absolute error values, averaged across stations, for each combination of parameters
"N"
and"alpha"
minMAE: Minimum MAE value
N: Value of parameter
"N"
corresponding to the minimum MAEalpha: Value of parameter
"alpha"
corresponding the the minimum MAEobserved: matrix with observed values (meteorological measured values)
predicted: matrix with interpolated values for the optimum parameter combination
If
update_interpolation_params
is FALSE, interpolator_calibration
returns the interpolator provided with the parameters updated
Functions
-
interpolation_cross_validation()
:
Author(s)
Miquel De Cáceres Ainsa, EMF-CREAF
Victor Granda García, EMF-CREAF
References
Thornton, P.E., Running, S.W., 1999. An improved algorithm for estimating incident daily solar radiation from measurements of temperature, humidity, and precipitation. Agric. For. Meteorol. 93, 211–228. doi:10.1016/S0168-1923(98)00126-9.
De Caceres M, Martin-StPaul N, Turco M, Cabon A, Granda V (2018) Estimating daily meteorological data and downscaling climate models over landscapes. Environmental Modelling and Software 108: 186-196.
Examples
# example interpolator
data("meteoland_interpolator_example")
# As the cross validation for all stations can be time consuming, we are
# gonna use only for the first 5 stations of the 198
cv <- interpolation_cross_validation(meteoland_interpolator_example, stations = 1:5)
# Inspect the results
cv$errors
cv$station_stats
cv$dates_stats
cv$r2
# example interpolator
data("meteoland_interpolator_example")
# As the calibration for all stations can be time consuming, we are gonna
# interpolate only for the first 5 stations of the 198 and only a handful
# of parameter combinations
calibration <- interpolator_calibration(
meteoland_interpolator_example,
stations = 1:5,
variable = "MaxTemperature",
N_seq = seq(10, 20, by = 5),
alpha_seq = seq(8, 9, by = 0.25)
)
# we can update the interpolator params directly:
updated_interpolator <- interpolator_calibration(
meteoland_interpolator_example,
stations = 1:5,
update_interpolation_params = TRUE,
variable = "MaxTemperature",
N_seq = seq(10, 20, by = 5),
alpha_seq = seq(8, 9, by = 0.25)
)
# check the new interpolator have the parameters updated
get_interpolation_params(updated_interpolator)$N_MaxTemperature
get_interpolation_params(updated_interpolator)$alpha_MaxTemperature