Cross validation of PCR reconstruction.
cvPCR(
Qa,
pc,
start.year,
transform = "log",
Z = NULL,
metric.space = "transformed"
)
Observations: a data.frame of annual streamflow with at least two columns: year and Qa.
For a single model: a data.frame, one column for each principal component. For an ensemble reconstruction: a list, each element is a data.frame of principal components.
Starting year of the climate proxies, i.e, the first year of the paleo period. start.year + nrow(pc) - 1
will determine the last year of the study horizon, which must be greater than or equal to the last year in Qa
.
Flow transformation, either "log", "boxcox" or "none". Note that if the Box-Cox transform is used, the confidence interval after back-transformation is simply the back-transform of the trained onfidence interval; this is hackish and not entirely accurate.
A list of cross-validation folds. If NULL
, will be created with make_Z()
with default settings. Users are advised to use make_Z()
to create the cross-validation folds beforehand. See make_Z for details.
Either "transformed" or "original", the space to calculate the performance metrics.
A list of cross validation results
metrics.dist: distribution of performance metrics across all cross-validation runs; a matrix, one column for each metric, with column names.
metrics: average performance metrics; a named vector.
obs: the (transformed) observations, a data.table with two columns (year, y)
Ycv: the predicted streamflow in each cross validation run; a matrix, one column for each cross-validation run
Z: the cross-validation fold
# NOT RUN {
cvPCR(NPannual, NPpc, start.year = 1200)
# }
Run the code above in your browser using DataLab