simulateSolute.loadReg2: Produce a set of predictions that reflect the coefficient...

View source: R/loadReg2.R

simulateSolute.loadReg2R Documentation

Produce a set of predictions that reflect the coefficient uncertainty and possibly also natural variation.

Description

This function resamples the coefficients from their joint distribution, then makes predictions whose individual errors are sampled from a time series with the same first-order autocorrelation as the original series of errors.

Usage

## S3 method for class 'loadReg2'
simulateSolute(load.model, flux.or.conc = c("flux",
  "conc"), newdata, method = c("parametric", "non-parametric"),
  from.interval = c("confidence", "prediction"), rho, ...)

Arguments

load.model

A loadReg2 object.

flux.or.conc

character. Should the simulations be reported as flux rates or concentrations?

newdata

data.frame, optional. Predictor data. Column names should match those given in the loadReg2 metadata. If newdata is not supplied, the original fitting data will be used.

method

character. The method by which the model should be bootstrapped. "non-parametric": resample with replacement from the original fitting data, refit the model, and make new predictions. "parametric": resample the model coefficients based on the covariance matrix originally estimated for those coefficients, then make new predictions.

from.interval

character. The interval type from which to resample (simulate) the solute. If "confidence", the regression model coefficients are resampled from their multivariate normal distribution and predictions are made from the new coefficients. If "prediction", an additional vector of noise is added to those "confidence"-based predictions.

rho

An autocorrelation coefficient to assume for the residuals, applicable when from.interval=="prediction". If rho is missing and interval=="prediction", rho will be estimated from the residuals calculated from newdata with the fitted (not yet resampled) load.model.

...

Other arguments passed to inheriting methods

Value

A vector of predictions that are distributed according to the uncertainty of the coefficients and the estimated natural variability + measurement error.

See Also

Other simulateSolute: simulateSolute.loadLm, simulateSolute.loadModel, simulateSolute


USGS-R/loadflex documentation built on July 26, 2023, 9:54 p.m.