Make flux or concentration predictions from a loadReg2 model.
Source:R/loadReg2.R
predictSolute.loadReg2.RdMakes instantaneous predictions (at the temporal resolution of
newdata) from a fitted loadReg2 model. See
predictSolute for details.
Usage
# S3 method for class 'loadReg2'
predictSolute(
load.model,
flux.or.conc = c("flux", "conc"),
newdata = getFittingData(load.model),
date = TRUE,
count = !identical(agg.by, "unit"),
se.fit = FALSE,
se.pred = FALSE,
interval = c("none", "confidence", "prediction"),
level = 0.95,
lin.or.log = c("linear", "log"),
agg.by = c("unit", "day", "month", "water year", "calendar year", "total", "[custom]"),
na.rm = FALSE,
attach.units = FALSE,
seopt = "exact",
print = FALSE,
allow.incomplete = FALSE,
...
)Arguments
- load.model
A loadReg2 object.
- flux.or.conc
character. Should the predictions be reported as flux rates or concentrations? If the output is a data.frame, the column name for flux predictions will be "fit" when `agg.by='unit'` and "Flux_Rate" otherwise; the column name for concentration predictions will be "fit" when `agg.by='unit'` and "Conc" otherwise.
- newdata
An optional data.frame of predictor observations. The column names in this data.frame must match those specified in the load model's metadata. If
newdatais not supplied, the original fitting data will be used.- date
logical. If TRUE, the output data.frame will include a column containing the dates or grouping variables of the predictions. For agg.by=="unit", the resulting column will be "date"; for agg.by=="water year", the column will be "water.year", and so on.
- count
logical; provides slightly different behavior than for other load.models. If TRUE, and if agg.by!='unit', the output data.frame will include a column named 'count.days' containing the number of _daily_ predictions going into each aggregated prediction (row).
- se.fit
logical. If TRUE, the output data.frame will include a column named "se.fit" describing the standard error of the model fit for each row of predictors.
- se.pred
logical. If TRUE, the output data.frame will include a column named "se.pred" describing the standard error of the prediction for each row of predictors. The se.pred values are standard errors of prediction (SEPs) and take into account not only the parameter uncertainty associated with the model coefficients (also covered by se.fit), but also the random error associated with any given observation (the epsilon term in a typical regression model).
- interval
character. One of "none", "confidence", or "prediction". If not "none", the interval bounds will be returned in columns named "lwr.fit" and "upr.fit" (for confidence intervals) or "lwr.pred" and "upr.pred" (for prediction intervals). Confidence intervals describe confidence in the model prediction for the mean value given a set of predictors, whereas prediction bounds describe the expected distribution of observations at that prediction point.
- level
numeric. Fraction of density distribution to include within the confidence or prediction interval
- lin.or.log
character. Either "linear" or "log" to say whether the predictions should be converted to log space or not. If converted to log space, a bias correction will be applied to regression model predictions; see
linToLog.- agg.by
character. The date interval or other grouping variable to aggregate results by. To do no aggregation, use the default of `agg.by='unit'`. If agg.by is one of "day", "month", "water year", or "calendar year", the dates vector will be split into periods corresponding to those intervals, and the flux or concentration will be computed for each period. If agg.by="total",
dateswill be ignored and the entire vectorpredswill be aggregated, weighting each point prediction equally. If agg.by is set to one or more custom values not in the list of default values, the values should be names of columns in `newdata`, and predictions will be grouped according to the values in those columns.- na.rm
logical. Should NA values be removed before aggregation (TRUE), or should NA be returned for intervals that contain one or more NA predictions (FALSE)?
- attach.units
logical. Should the units be attached to columns in the resulting data.frame?
- seopt
Argument passed to
predLoadwhen format=="flux", otherwise ignored. According to ?predLoad, "a character string indicating how to comute the standard error of the aggregated load estimates, must be either "exact" or "approximate.""Argument passed to
predLoadwhen format=="flux", otherwise ignored. According to ?predLoad, "print a report summary of the load estimate?"- allow.incomplete
Argument passed to
predLoadorpredConc(the value of `format` determines which rloadest function is called). According to ?predLoad, "compute loads for periods withing missing values or incomplete record?"- ...
Additional arguments passed to class-specific implementations of the
predictSolutegeneric function.
Value
A vector of data.frame of predictions, as for the generic
predictSolute.
See also
Other predictSolute:
predictSolute(),
predictSolute.loadComp(),
predictSolute.loadInterp(),
predictSolute.loadLm(),
predictSolute.loadModel()