gcmlcm: Greatest Convex Minorant and Least Concave Majorant

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

View source: R/gcmlcm.R

Description

gcmlcm computes the greatest convex minorant (GCM) or the least concave majorant (LCM) of a piece-wise linear function.

Usage

1
gcmlcm(x, y, type=c("gcm", "lcm"))

Arguments

x, y

coordinate vectors of the piece-wise linear function. Note that the x values need to be unique and be arranged in sorted order.

type

specifies whether to compute the greatest convex minorant (type="gcm", the default) or the least concave majorant (type="lcm").

Details

The GCM is obtained by isotonic regression of the raw slopes, whereas the LCM is obtained by antitonic regression. See Robertson et al. (1988).

Value

A list with the following entries:

x.knots

the x values belonging to the knots of the LCM/GCM curve

y.knots

the corresponding y values

slope.knots

the slopes of the corresponding line segments

Author(s)

Korbinian Strimmer (https://strimmerlab.github.io).

References

Robertson, T., F. T. Wright, and R. L. Dykstra. 1988. Order restricted statistical inference. John Wiley and Sons.

See Also

monoreg.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
# load "fdrtool" library
library("fdrtool")

# generate some data
x = 1:20
y = rexp(20)
plot(x, y, type="l", lty=3, main="GCM (red) and LCM (blue)")
points(x, y)

# greatest convex minorant (red)
gg = gcmlcm(x,y)
lines(gg$x.knots, gg$y.knots, col=2, lwd=2)

# least concave majorant (blue)
ll = gcmlcm(x,y, type="lcm")
lines(ll$x.knots, ll$y.knots, col=4, lwd=2)

fdrtool documentation built on Nov. 14, 2021, 1:07 a.m.

Related to gcmlcm in fdrtool...