# NOT RUN {
# Peaks for 08165300 (1968--2016, systematic record only)
#https://nwis.waterdata.usgs.gov/nwis/peak?site_no=08385600&format=hn2
Peaks <- c(3200, 44, 5270, 26300, 1230, 55, 38400, 8710, 143, 23200, 39300, 1890,
27800, 21000, 21000, 124, 21, 21500, 57000, 53700, 5720, 50, 10700, 4050, 4890, 1110,
10500, 475, 1590, 26300, 16600, 2370, 53, 20900, 21400, 313, 10800, 51, 35, 8910,
57.4, 617, 6360, 59, 2640, 164, 297, 3150, 2690)
MGBTcohn2016(Peaks)
#$klow
#[1] 24
#$pvalues
# [1] 0.8245714657 0.7685258183 0.6359392507 0.4473443285 0.2151390091 0.0795065159
# [7] 0.0206034851 0.0036001474 0.0003376923 0.0028133490 0.0007396869 0.0001427225
#[13] 0.0011045550 0.0001456356 0.0004178758 0.0004138897 0.0123954279 0.0067934260
#[19] 0.0161448464 0.0207025800 0.0483890616 0.0429628125 0.0152045539 0.0190853626
#$LOThresh
#[1] 3200
# ---***--------------***--- Note the mismatch ---***--------------***---
#The USGS-PeakFQ (v7.1) software reports:
#EMA003I-PILFS (LOS) WERE DETECTED USING MULTIPLE GRUBBS-BECK TEST 16 1110.0
# THE FOLLOWING PEAKS (WITH CORRESPONDING P-VALUES) WERE CENSORED:
# 21.0 (0.8243)
# 35.0 (0.7680)
# 44.0 (0.6349)
# 50.0 (0.4461) # Authors' note:
# 51.0 (0.2150) # Note that the p-values from USGS-PeakFQv7.1 are
# 53.0 (0.0806) # slightly different from those emanating from R.
# 55.0 (0.0218) # These are thought to be from numerical issues.
# 57.4 (0.0042)
# 59.0 (0.0005)
# 124.0 (0.0034)
# 143.0 (0.0010)
# 164.0 (0.0003)
# 297.0 (0.0015)
# 313.0 (0.0003)
# 475.0 (0.0007)
# 617.0 (0.0007)
# ---***--------------***--- Note the mismatch ---***--------------***---
# There is a problem somewhere. Let us test each of the TAC versions available.
# Note that MGBTnb() works because the example peaks are ultimately a "sweep out"
# problem. MGBT17c() is a WHA fix to TAC algorithm, whereas, MGBT17c.verb() is
# a verbatim, though slower, WHA port of the written language in Bulletin 17C.
MGBTcohn2016(Peaks)$LOThres # LOT=3200 (WHA sees TAC problem with "sweep out".)
MGBTcohn2013(Peaks)$LOThres # LOT=16600 (WHA sees TAC problem with "sweep out".)
MGBTnb(Peaks)$LOThres # LOT=1110 (WHA sees TAC problem with "sweep in". )
MGBT17c(Peaks)$index # LOT=1110 (sweep indices:
# ix_alphaout=16, ix_alphain=16, ix_alphazeroin=0)
MGBT17c.verb(Peaks)$index # LOT=1110 (sweep indices:
# ix_alphaout=16, ix_alphain=NA, ix_alphazeroin=0)
# Let us now make a problem, which will have both "sweep in" and "sweep out"
# characteristics, and note the zero and unity outliers for the "sweep in" to grab.
Peaks <- c(0,1,Peaks)
MGBTcohn2016(Peaks)$LOThres # LOT=3150 ..ditto..
MGBTcohn2013(Peaks)$LOThres # LOT=16600 ..ditto..
MGBTnb(Peaks)$LOThres # LOT=1110 ..ditto..
MGBT17c(Peaks)$index # LOT=1110 (sweep indices:
# ix_alphaout=18, ix_alphain=18, ix_alphazeroin=2
MGBT17c.verb(Peaks)$index # LOT=1110 (sweep indices:
# ix_alphaout=18, ix_alphain=NA, ix_alphazeroin=2
#The USGS-PeakFQ (v7.1) software reports:
# EMA003I-PILFS (LOS) WERE DETECTED USING MULTIPLE GRUBBS-BECK TEST 17 1110.0
# THE FOLLOWING PEAKS (WITH CORRESPONDING P-VALUES) WERE CENSORED:
# 1 ZERO VALUES
# 1.0 (0.0074)
# 21.0 (0.4305)
# 35.0 (0.4881)
# 44.0 (0.3987)
# 50.0 (0.2619)
# 51.0 (0.1107)
# 53.0 (0.0377)
# 55.0 (0.0095)
# 57.4 (0.0018)
# 59.0 (0.0002)
# 124.0 (0.0018)
# 143.0 (0.0006)
# 164.0 (0.0002)
# 297.0 (0.0010)
# 313.0 (0.0002)
# 475.0 (0.0005)
# 617.0 (0.0005) #
# }
Run the code above in your browser using DataLab