wBT: Run the WBT (WRTDS Bootstrap Test)

View source: R/wBTCode.R

wBTR Documentation

Run the WBT (WRTDS Bootstrap Test)

Description

Runs the WBT for a given data set to evaluate the significance level and confidence intervals for the trends between two specified years. The trends evaluated are trends in flow normalized concentration and flow normalized flux. Function produces text outputs and a named list (eBoot) that contains all of the relevant outputs. Check out runPairsBoot and runGroupsBoot for more bootstrapping options. The wBT only runs stationary flow normalization (i.e. making the assumption that discharge is stationary). The runPairsBoot and runGroupsBoot allow for generalized flow normalization (i.e. non-stationary discharge).

Usage

wBT(eList, caseSetUp, saveOutput = TRUE, fileName = "temp.txt",
  startSeed = 494817, jitterOn = FALSE, V = 0.2)

Arguments

eList

named list with at least the Daily, Sample, and INFO dataframes. Created from the EGRET package, after running modelEstimation.

caseSetUp

data frame. Returned from trendSetUp.

saveOutput

logical. If TRUE, a text file will be saved in the working directory.

fileName

character. Name to save the output file if saveOutput=TRUE.

startSeed

setSeed value. Defaults to 494817. This is used to make repeatable output.

jitterOn

logical, if TRUE, adds "jitter" to the data in an attempt to avoid some numerical problems. Default = FALSE. See Details below.

V

numeric a multiplier for addition of jitter to the data, default = 0.2. See Details below.

Details

In some situations numerical problems are encountered in the bootstrap process, resulting in highly unreasonable spikes in the confidence intervals. The use of "jitter" can often prevent these problems, but should only be used when it is clearly needed. It adds a small amount of random "jitter" to the explanatory variables of the WRTDS model. The V parameter sets the scale of variation in the log discharge values. The standard deviation of the added jitter is V * standard deviation of Log Q. The default for V is 0.2. Larger values should generally be avoided, and smaller values may be sufficient.

Value

eBoot, a named list with bootOut, wordsOut, xConc, xFlux, pConc, pFlux values.

Object Description
bootOut a data frame with the results of the bootstrap test.
wordsOut a character vector describing the results.
xConc and xFlux vectors of length iBoot, of the change in flow normalized concentration and flow normalized flux computed from each of the bootstrap replicates.
pConc and pFlux vectors of length iBoot, of the change in flow normalized concentration or flow normalized flux computed from each of the bootstrap replicates expressed as % change.

See Also

trendSetUp, setForBoot, runGroupsBoot, runPairsBoot

Examples

eList <- EGRET::Choptank_eList
caseSetUp <- trendSetUp(eList,
                        year1 = 1985, 
                        year2 = 2005,
                        nBoot = 50, 
                        bootBreak = 39,
                        blockLength = 200)
# Very long-running function:                     
## Not run: 
eBoot <- wBT(eList,caseSetUp)

## End(Not run)

USGS-R/EGRETci documentation built on April 17, 2023, 8 p.m.