fliplmoms: Flip L-moments by Flip Attribute in L-moment Vector

Description Usage Arguments Value Author(s) References See Also Examples

Description

This function flips the L-moments by a flip attribute within an L-moment object such as that returned by lmomsRCmark. The function will attempt to identify the L-moment object and lmorph as necessary, but this support is not guaranteed. The flipping process is used to support left-tail censoring using the right-tail censoring alogrithms of lmomco. The odd order (seq(3,n,by2)) λ_r and τ_r are negated. The mean \hatλ_1 is computed by subtracting the λ_1 from the lmom argument from the flip M: \hatλ_1 = M - λ_1 and the τ_2 is subsequently adjusted by the new mean. This function is written to provide a convenient method to re-transform or back flip the L-moments computed by lmomsRCmark. Detailed review of the example problem listed here is recommended.

Usage

1
fliplmoms(lmom, flip=NULL, checklmom=TRUE)

Arguments

lmom

A L-moment object created by lmomsRCmark or other vectorize L-moment list.

flip

lmomsRCmark provides the flip, but for other vectorized L-moment list support, the flip can be set by this argument.

checklmom

Should the lmom be checked for validity using the are.lmom.valid function. Normally this should be left as the default and it is very unlikely that the L-moments will not be viable (particularly in the τ_4 and τ_3 inequality). However, for some circumstances or large simulation exercises then one might want to bypass this check.

Value

An R list is returned that matches the structure of the lmom argument (unless an lmorph was attempted). The structure is intended to match that coming from lmomsRCmark.

Author(s)

W.H. Asquith

References

Wang, Dongliang, Hutson, A.D., and Miecznikowski, J.C., 2010, L-moment estimation for parametric survival models given censored data: Statistical Methodology, v. 7, no. 6, pp. 655–667.

Helsel, D.R., 2005, Nondetects and data analysis—Statistics for censored environmental data: Hoboken, New Jersey, John Wiley, 250 p.

See Also

lmomsRCmark

Examples

 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
# Create some data with **multiple detection limits**
# This is a left-tail censoring problem, and flipping will be required.
fakedat1 <- rnorm(50, mean=16, sd=5)
fake1.left.censor.indicator <- fakedat1 <  14
fakedat1[fake1.left.censor.indicator]   <- 14

fakedat2 <- rnorm(50, mean=16, sd=5)
fake2.left.censor.indicator <- fakedat2 <  10
fakedat2[fake2.left.censor.indicator]   <- 10

# combine the data sets
fakedat <- c(fakedat1, fakedat2);
fake.left.censor.indicator <- c(fake1.left.censor.indicator,
                                fake2.left.censor.indicator)
ix <- order(fakedat)
fakedat <- fakedat[ix]
fake.left.censor.indicator <- fake.left.censor.indicator[ix]

lmr.usual       <- lmoms(fakedat)
lmr.flipped     <- lmomsRCmark(fakedat, flip=TRUE,
                               rcmark=fake.left.censor.indicator)
lmr.backflipped <- fliplmoms(lmr.flipped); # re-transform
pch <- as.numeric(fake.left.censor.indicator)*15 + 1
F <- nonexceeds()
plot(pp(fakedat), sort(fakedat), pch=pch,
     xlab="NONEXCEEDANCE PROBABILITY", ylab="DATA VALUE")
lines(F, qlmomco(F, parnor(lmr.backflipped)), lwd=2)
lines(F, qlmomco(F, parnor(lmr.usual)), lty=2)
legend(0,20, c("Uncensored", "Left-tail censored"), pch=c(1,16))
# The solid line represented the Normal distribution fit by
# censoring indicator on the multiple left-tail detection limits.
## Not run: 
# see example in pwmRC
H <- c(3,4,5,6,6,7,8,8,9,9,9,10,10,11,11,11,13,13,13,13,13,
       17,19,19,25,29,33,42,42,51.9999,52,52,52)
# 51.9999 was really 52, a real (noncensored) data point.
flip <- 100
F <- flip - H #
RCpwm <- pwmRC(H, threshold=52)
lmorph(pwm2lmom(vec2pwm(RCpwm$Bbetas))) # OUTPUT1 STARTS HERE

LCpwm <- pwmLC(F, threshold=(flip - 52))
LClmr <- pwm2lmom(vec2pwm(LCpwm$Bbetas))
LClmr <- lmorph(LClmr)
#LClmr$flip <- 100; fliplmoms(LClmr) # would also work
fliplmoms(LClmr, flip=flip) # OUTPUT2 STARTS HERE

# The two outputs are the same showing how the flip argument works 
## End(Not run)

lmomco documentation built on March 14, 2020, 5:06 p.m.