Prepare water quality data for weighted regression by creating a tidal class object
tidal(
dat_in,
ind = c(1, 2, 3, 4),
reslab = NULL,
flolab = NULL,
reslog = TRUE,
rm_miss = FALSE,
...
)
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
four element numeric vector indicating column positions of date, response variable, salinity/flow, and detection limit of input data frame
character string or expression for labelling the response variable in plots, defaults to log-chlorophyll in ug/L
character string or expression for labelling the flow variable in plots, defaults to Salinity
logical indicating if the response variable is already in log-space, default TRUE
logical indicating if missing observations in the input data are removed
arguments passed from other methods
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:
names
Column names of the data frame
row.names
Row names of the data frame
class
Class of the object
half_wins
List 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 if wrtds
has not been used.
fits
List of matrices with fits for the WRTDS interpolation grid, defaults to one list for the median quantile. Initially will be NULL
if wrtds
has not been used.
predonobs
A data.frame
of predictions using the observed data that were used to fit the model. This is required for wrtdsperf
if a novel dataset is used for predictions after fitting the model. Initially will be NULL if respred
has not been used.
flo_grd
Numeric vector of salinity/flow values that was used for the interpolation grids
floobs_rng
Two element vector indicating the salinity/flow range of the observed data
nobs
List 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 be NULL
if wrtds
has not been used.
reslab
expression or character string for response variable label in plots
flolab
expression or character string for flow variable label in plots
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.
## raw data
data(chldat)
## format
chldat <- tidal(chldat)