Join us for
RADAR: AI Edition

MGBT (version 1.0.7)

EMS: Expected values of M and S

Description

Compute expected values of M and S given qmin and define the quantity zr=Φ(1)(qmin), where Φ(1)(⋅) is the inverse of the standard normal distribution. As result, qmin is itself a probability because it is an argument to the qnorm() function. The expected value M is defined as M=Ψ(zr,1), where Ψ(a,b) is the gtmoms function. The S requires the conditional moments of the Chi-square (CondMomsChi2) defined as the two value vector 2S that provides the values α=2S12/2S2 and β=2S2/2S1. The S is then defined by S=β(Γ(α+0.5)Γ(α)).

Usage

EMS(n, r, qmin)

Arguments

n

The number of observations;

r

The number of truncated observations? (confirm); and

qmin

A nonexceedance probability threshold for X>qmin.

Value

The expected values of M and S in the form of an R vector.

References

Cohn, T.A., 2013--2016, Personal communication of original R source code: U.S. Geological Survey, Reston, Va.

See Also

CondMomsChi2, EMS, VMS, V, gtmoms

Examples

Run this code
# NOT RUN {
EMS(58,2,.5)
#[1] 0.7978846 0.5989138

#  Monte Carlo experiment to test EMS and VMS functions
"test_EMS" <- function(nrep=1000, n=100, r=0, qr=0.2, ss=1) { # TAC named function
   set.seed(ss)
   Moms <- replicate(n=nrep, {
          x <- qnorm(runif(n-r,min=qr,max=1));
          c(mean(x),var(x))}); xsi <- qnorm(qr);
          list(
    MeanMS_obs = c(mean(Moms[1,]), mean(sqrt(Moms[2,])), mean(Moms[2,])),
    EMS        = c(EMS(n,r,qr), gtmoms(xsi,2) - gtmoms(xsi,1)^2),
    CovMS2_obs = cov(t(Moms)),
    VMS2       = V(n,r,qr),
    VMS_obs    = array(c(var(     Moms[1,]),
                         rep(cov( Moms[1,], sqrt(Moms[2,])),2),
                         var(sqrt(Moms[2,]))),    dim=c(2,2)),
    VMS        = VMS(n,r,qr)  )
}
test_EMS()
# }

Run the code above in your browser using DataLab