Jack-Knife cross validation of the WRTDS (Weighted Regressions on Time, Discharge, and Season)
Source:R/estCrossVal.R
estCrossVal.Rd
This function fits the WRTDS model n times (where n is the number of observations). For each fit, the data value being estimated is eliminated from the record. This gives predictions that do not depend on knowing the actual result for that day. Thus it provides for a more "honest" estimate of model performance than a traditional error analysis that uses all the data.
Usage
estCrossVal(DecLow, DecHigh, Sample, windowY = 7, windowQ = 2,
windowS = 0.5, minNumObs = 100, minNumUncen = 50, edgeAdjust = TRUE,
verbose = TRUE)
Arguments
- DecLow
number specifying minimum decimal year
- DecHigh
number specifying maximum decimal year
- Sample
data frame containing the sample values, default is Sample
- windowY
numeric specifying the half-window width in the time dimension, in units of years, default is 7
- windowQ
numeric specifying the half-window width in the discharge dimension, units are natural log units, default is 2
- windowS
numeric specifying the half-window with in the seasonal dimension, in units of years, default is 0.5
- minNumObs
numeric specifying the miniumum number of observations required to run the weighted regression, default is 100
- minNumUncen
numeric specifying the minimum number of uncensored observations to run the weighted regression, default is 50
- edgeAdjust
logical specifying whether to use the modified method for calculating the windows at the edge of the record. The modified method tends to reduce curvature near the start and end of record. Default is TRUE.
- verbose
logical specifying whether or not to display progress message
Value
SampleCrossV data frame containing the sample data augmented by the results of the cross-validation exercise
Examples
eList <- Choptank_eList
Sample <- getSample(eList)
Daily <- getDaily(eList)
numDays <- length(Daily$DecYear)
DecLow <- Daily$DecYear[1]
DecHigh <- Daily$DecYear[numDays]
# \donttest{
SampleCrossV <- estCrossVal(DecLow,DecHigh,Sample)
#>
#> estCrossVal % complete:
#> 0 1 2 3 4 5 6 7 8 9 10
#> 11 12 13 14 15 16 17 18 19 20
#> 21 22 23 24 25 26 27 28 29 30
#> 31 32 33 34 35 36 37 38 39 40
#> 41 42 43 44 45 46 47 48 49 50
#> 51 52 53 54 55 56 57 58 59 60
#> 61 62 63 64 65 66 67 68 69 70
#> 71 72 73 74 75 76 77 78 79 80
#> 81 82 83 84 85 86 87 88 89 90
#> 91 92 93 94 95 96 97 98 99
# }