Skip to contents

Replace a distribution's tail. graft_left() takes a base distribution and grafts a distribution to the left of some breakpoint; graft_right() grafts a distribution to the right. The distribution being grafted is sliced at a breakpoint and fit to the base distribution also at that breakpoint.

Usage

graft_right(distribution, graft, breakpoint, include = FALSE)

graft_left(distribution, graft, breakpoint, include = FALSE)

is_graft(object)

Arguments

distribution

Base distribution

graft

The distribution being grafted.

breakpoint

The location of the graft

include

Logical; include the breakpoint in the base distribution?

object

Object to be tested

Value

Graft distribution object, which is a special type of mixture distribution.

Examples

set.seed(1)
x <- stats::rcauchy(100)
base <- distionary::dst_empirical(x)
q <- distionary::eval_quantile(base, at = 0.9)
right <- distionary::dst_gpd(q, 5, 1)
g <- graft_right(base, right, breakpoint = q)
#plot(g, "cdf", n = 1001, to = 34)
#plot(base, "cdf", n = 1001, lty = 2, add = TRUE)