Get model predictions from WRTDS using linear interpolation of values in grids
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
Returns
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'.
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.
Examples
### load a tidal objectdata(tidobj)# get fitted values for each quantileres <- respred(tidobj)# load a tidalmean objectdata(tidobjmean)# get predicted valuesres <- respred(tidobjmean)