peta {MGBT} | R Documentation |
Probability of Eta
Description
Compute peta
, which is the survival probability of the t-distribution for eta =
\eta
.
Define b_r
as the inverse (quantile) of the Beta distribution for nonexceedance probability F \in (0,1)
having two shape parameters (\alpha
and \beta
) as
b_r = \mathrm{Beta}^{(-1)}(F; \alpha, \beta) = \mathrm{Beta}^{(-1)}(F; r, n+1-r)\mbox{,}
for sample size n
and number of truncated observations r
and note that b_r \in (0,1)
. Next, define z_r
as the Z
-score for b_r
z_r = \Phi^{(-1)}(b_r)\mbox{,}
where \Phi^{(-1)}(\cdots)
is the inverse of the standard normal distribution.
Compute the covariance matrix COV
of M
and S
from VMS
as in COV = VMS(n, r, qmin=br)
, and from which define
\lambda = COV_{1,2} / COV_{2,2}\mbox{,}
which is a covariance divided by a variance, and then define
\eta_p = \lambda + \eta\mbox{.}
Compute the expected values of M
and S
from EMS
as in EMp =
EMp = EMS(n, r, qmin=br)
, and from which define
\mu_{Mp} = EMp_1 - \lambda\times EMp_2\mbox{,}
\sigma_{Mp} = \sqrt{COV_{1,1} - COV_{1,2}^2/COV_{2,2}}\mbox{.}
Compute the conditional moments from CondMomsChi2
as in momS2 =
CondMomsChi2(n,r,zr)
, and from which define
df = 2 momS2_1^2 / momS2_2\mbox{,}
\alpha = momS2_2 / momS2_1\mbox{,}
Usage
peta(pzr, n, r, eta)
Arguments
pzr |
The probability level of a Beta distribution having shape1 |
n |
The number of observations; |
r |
The number of truncated observations; and |
eta |
The Grubbs–Beck statistic ( |
Details
Currently (2019), context is lost on the preformatted note of code note below. It seems possible that the intent by WHA was to leave a trail for future revisitation of the Beta distribution and its access, which exists in native R code.
zr <- qnorm(qbeta(the.pzr, shape1=r, shape2=n+1-r)) CV <- VMS(n, r, qmin=pnorm(zr))
Value
The probability of the eta
value.
Note
Testing a very large streamgage dataset in Texas with GRH, shows at least one failure of the following computation was encountered for a short record streamgage numbered 08102900.
# USGS 08102900 (data sorted, 1967--1974) #https://nwis.waterdata.usgs.gov/nwis/peak?site_no=08102900&format=hn2 Peaks <- c(40, 45, 53, 55, 88) # in cubic feet per second (cfs) MGBT(Peaks) # Here is the line in peta(): SigmaMp <- sqrt(CV[1,1] - CV[1,2]^2/CV[2,2]) # *** In sqrt(CV[1, 1] - CV[1, 2]^2/CV[2, 2]) : NaNs produced
In implementation, a suppressWarnings()
is wrapped on the SigmaMp
. If the authors make no action in response to NaN
, then the low-outlier threshold is 53 cubic feet per second (cfs) with a p-value for 40 cfs as 0.81 and 45 cfs as 0.0. This does not seem logical. The is.finite
catch in the next line (see sources) is provisional under a naïve assumption that the negative in the square root has barely undershot. The function is immediately exited with the returned p-value set to unity. Testing indicates that this is a favorable innate trap here within the MGBT package and will avoid higher up error trapping in larger application development.
Author(s)
W.H. Asquith consulting T.A. Cohn source
Source
LowOutliers_jfe(R).txt
, LowOutliers_wha(R).txt
, P3_089(R).txt
—Named peta
References
Cohn, T.A., 2013–2016, Personal communication of original R source code: U.S. Geological Survey, Reston, Va.
See Also
EMS
, VMS
, CondMomsChi2
, gtmoms
Examples
peta(0.4, 58, 2, -2.3006)
#[1] 0.298834