respred: Get WRTDS predictions from interpolation grids

View source: R/respred.R

respredR Documentation

Get WRTDS predictions from interpolation grids

Description

Get model predictions from WRTDS using linear interpolation of values in grids

Usage

respred(dat_in, ...)

## S3 method for class 'tidal'
respred(dat_in, dat_pred = NULL, trace = TRUE, omit = TRUE, ...)

## S3 method for class 'tidalmean'
respred(dat_in, dat_pred = NULL, trace = TRUE, omit = TRUE, ...)

Arguments

dat_in

input tidal or tidalmean object

...

arguments passed to or from other methods

dat_pred

optional data to predict using the interpolation grids in dat_in, defaults to observed data in dat_in if not supplied, see details

trace

logical indicating if progress is shown in the console

omit

logical indicating if observations in dat_pred that are outside of the range of data used to fit the model are removed, see details

Details

This function is used after wrtds to estimate predicted values of the response variable from the interpolation grids. The estimated values are based on a bilinear interpolation of the four predicted response values at two salinity/flow and two date values nearest to the observed salinity/flow and date values to predict.

Data for dat_pred must be a data frame of two columns for date and flow variables (date and numeric objects). The columns must be named 'date' and 'flo'. Values that are outside of the range of data used to fit the model are removed with a warning. It is assumed that the flow variable is not scaled (i.e., raw data) as in a tidal or tidalmean object. The dimensions of the output data are modified to match dat_pred if observations are removed. The omit argument should not equal FALSE and is included only for use with wrtdscv to evaluate folds of the original dataset.

Value

Appends columns to the input data.frame for the predicted values. For tidal objects, columns are named starting with the prefix ‘fit’, e.g., ‘fit0.5’ are the predicted values for the fit through the median. For tidalmean objects, predicted values are appended for the mean model in log-space and the observed values from the back-transformed grids. Columns are named as ‘fits’ and ‘bt_fits’.

Examples

##

# load a tidal object
data(tidobj)

# get fitted values for each quantile
res <- respred(tidobj)

# load a tidalmean object
data(tidobjmean)

# get predicted values
res <- respred(tidobjmean)


WRTDStidal documentation built on Oct. 20, 2023, 5:08 p.m.