| tidal {WRTDStidal} | R Documentation |
Create a tidal class object
Description
Prepare water quality data for weighted regression by creating a tidal class object
Usage
tidal(
dat_in,
ind = c(1, 2, 3, 4),
reslab = NULL,
flolab = NULL,
reslog = TRUE,
rm_miss = FALSE,
...
)
Arguments
dat_in |
Input data frame for a water quality time series with four columns for date (Y-m-d format), response variable, salinity/flow, and detection limit for left-censored data |
ind |
four element numeric vector indicating column positions of date, response variable, salinity/flow, and detection limit of input data frame |
reslab |
character string or expression for labelling the response variable in plots, defaults to log-chlorophyll in ug/L |
flolab |
character string or expression for labelling the flow variable in plots, defaults to Salinity |
reslog |
logical indicating if the response variable is already in log-space, default |
rm_miss |
logical indicating if missing observations in the input data are removed |
... |
arguments passed from other methods |
Details
This function is a simple wrapper to structure that is used to create a tidal object for use with weighted regression in tidal waters. Input data should be a four-column data.frame with date, response variable, salinity/flow data, and detection limit for each observation of the response. The response variable is assumed to be log-transformed, otherwise use reslog = FALSE. Salinity data can be provided as fraction of freshwater or as parts per thousand. The limit column can be entered as a sufficiently small number if all values are above the detection limit or no limit exists. The current implementation of weighted regression for tidal waters only handles left-censored data. Missing observations are also removed.
Value
A tidal object as a data frame and attributes. The data frame has columns ordered as date, response variable, salinity/flow (rescaled to 0, 1 range), detection limit, logical for detection limit, day number, month, year, and decimal time. The attributes are as follows:
namesColumn names of the data frame
row.namesRow names of the data frame
classClass of the object
half_winsList of numeric values used for half-window widths for model fitting, in the same order as the wt_vars argument passed to
getwts. Initially will be NULL ifwrtdshas not been used.fitsList of matrices with fits for the WRTDS interpolation grid, defaults to one list for the median quantile. Initially will be
NULLifwrtdshas not been used.predonobsA
data.frameof predictions using the observed data that were used to fit the model. This is required forwrtdsperfif a novel dataset is used for predictions after fitting the model. Initially will be NULL ifrespredhas not been used.flo_grdNumeric vector of salinity/flow values that was used for the interpolation grids
floobs_rngTwo element vector indicating the salinity/flow range of the observed data
nobsList with one matrix showing the number of weights greater than zero for each date and salinity/flow combination used to create the fit matrices in
fits. Number of observations are the same for each quantile model. Initially will beNULLifwrtdshas not been used.reslabexpression or character string for response variable label in plots
flolabexpression or character string for flow variable label in plots
Examples
## raw data
data(chldat)
## format
chldat <- tidal(chldat)