get.predictors: Build spline basis functions

Description Usage Arguments Value Multiple runs/files Volcanic forcing

View source: R/get_predictors.R

Description

get.predictors builds basis functions as predictors for the quantile regression in the quantile mapping climate projection method of Haugen et al. 2018. The basis functions are constructed such that the resultant quantile estimate is smoothly varying and depends on:

  1. the seasonal cycle (dependent only on month-of-year), estimated by a periodic b-spline

  2. the long-term trend (dependent only on the year index), estimated by a natural cubic spline

  3. an interaction between the seasonal cycle and long-term trend (to capture changes in the seasonal cycle)

The degrees of freedom for each of these basis functions are set through the parameters df.x, df.t, and df.xt, respectively, or through a 3 x 1 vector dfs.

Usage

1
2
3
4
get.predictors(n_files = 1, dfs = numeric(), df.x = numeric(),
  df.t = numeric(), df.xt = numeric(), year.range = c(1850, 2099),
  get.volc = FALSE, lat = numeric(), save.predictors = FALSE,
  save.fn = character())

Arguments

n_files

number of runs (if > 1, this ensures that Jan 1, 1971, Run 1 has the same basis function value as Jan 1, 1971, Run 2, etc.). Basis functions are repeated end-to-end n_files times.

dfs

degrees of freedom - a [3 x 1] vector giving the seasonal, long term change, and interaction degrees of freedom, respectively

df.x, df.t, df.xt

alternatively, input the dfs separately, with seasonal df.x, long-term df.t, and interaction df.xt (kept for backwards compatibility with some older functions)

year.range

c(start_year,end_year), or, if get.volc=FALSE, can also just be a number giving the length in years of the used time series.

get.volc

whether to add a volcanic degree of freedom

lat

only necessary if get.volc=TRUE; This is the latitude of the pixel for which basis functions should be calculated.

save.predictors

if true, the basis functions are saved to an .RData file (def: FALSE)

save.fn

if save.predictors=TRUE, this sets the name of the file to save the basis functions to. By default, the filename is: "[aux.dir]/bases/spline_basis_functions_[nyears]years_[n_files]runs_[df.x]-[df.t]-[df.xt]df(_[lat.volc]volc).RData"

Value

a numerical matrix

Multiple runs/files

get.predictors is specifically designed to allow for basis functions for quantile regression across multiple data sets that span the same time period. In the context of the quantile mapping climate projection method, these multiple data sets are multiple runs of the same model over the same time period. In this case, the basis vectors are repeated end-to-end n_files times.

Volcanic forcing

The get.volc input additionally allows for the addition of a historical volcanic CO2 forcing as a predictor for the quantile regression. This volcanic forcing is taken from the XXXXXX hindcast from CCSM4XXXX. If get.volc=TRUE, then a latitude must be specified through the lat parameter. Since the volcanic forcing is only available 1850-2008, this is discouraged for values beyond 2008...


ks905383/quantproj documentation built on Nov. 1, 2020, 9:12 p.m.