simulateSolute: Simulate solute concentrations based on the model and model...

View source: R/loadModelInterface.R

simulateSoluteR Documentation

Simulate solute concentrations based on the model and model uncertainty.

Description

This function is an optional component of the loadModelInterface. It is unnecessary for model fitting, assessment, and prediction except when used in conjunction with the composite method (i.e., within a loadComp model).

Usage

simulateSolute(load.model, flux.or.conc = c("flux", "conc"), newdata,
  method = c("non-parametric", "parametric"),
  from.interval = c("confidence", "prediction"), rho, ...)

Arguments

load.model

A load model object, typically inheriting from loadModel and always implementing the loadModelInterface.

flux.or.conc

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

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.

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 or data.frame of predictions, as for the generic predictSolute. The simulated predictions are distributed according to the uncertainty of the coefficients (if from.interval=="confidence") and also the estimated natural variability + measurement error (if from.interval=="prediction").

See Also

Other loadModelInterface: estimateMSE, getFittedModel, getFittingData, getFittingFunction, getMetadata, predictSolute, summarizeModel, validLoadModelInterface

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


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