The function that does the uncertainty analysis for determining the change between any
pair of years. It is very similar to the wBT
function that runs the WRTDS
bootstrap test. It differs from wBT
in that it runs a specific number of
bootstrap replicates, unlike the wBT
approach that will stop running replicates
based on the status of the test statistics along the way. Also, this code can be used with
generalized flow normalization, which handles non-stationary discharge,
whereas wBT
does not.
Usage
runPairsBoot(eList, pairResults, nBoot = 100, startSeed = 494817,
blockLength = 200, jitterOn = FALSE, V = 0.2)
Arguments
- eList
named list with at least the Daily, Sample, and INFO dataframes
- pairResults
data frame returned from
runPairs
- nBoot
the maximum number of bootstrap replicates to be used, typically 100
- startSeed
setSeed value. Defaults to 494817. This is used to make repeatable output.
- blockLength
integer size of subset, expressed in days. 200 days has been found to be a good choice.
- 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.
Value
eBoot, a named list with bootOut, wordsOut, xConc, xFlux, pConc, pFlux values.
bootOut is a data frame with the results of the bootstrap test.
wordsOut is a character vector describing the results.
xConc and xFlux are 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 are 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
library(EGRET)
eList <- Choptank_eList
year1 <- 1985
year2 <- 2009
if (FALSE) {
pairOut_2 <- runPairs(eList, year1, year2, windowSide = 7)
boot_pair_out <- runPairsBoot(eList, pairOut_2)
plotHistogramTrend(eList, boot_pair_out, caseSetUp = NA)
}