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.
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. |
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.
Examples
eList <- EGRET::Choptank_eList
caseSetUp <- trendSetUp(eList,
year1 = 1985,
year2 = 2005,
nBoot = 50,
bootBreak = 39,
blockLength = 200)
#> Sample set runs from 1979 to 2011
#> year1 = 1985 this is the first water year of trend period
#> year2 = 2005 this is the last water year of trend period
#> nBoot = 50 this is the maximum number of replicates that will be run
#> bootBreak = 39 this is the minimum number of replicates that will be run
#> blockLength = 200 this is the number of days in a bootstrap block
# Very long-running function:
if (FALSE) {
eBoot <- wBT(eList,caseSetUp)
}