jumpint: Confidence intervals for jumps and confidence bands for step...

jumpintR Documentation

Confidence intervals for jumps and confidence bands for step functions

Description

Extract and plot confidence intervals and bands from fits given by a stepfit object.

Usage

jumpint(sb, ...)
## S3 method for class 'stepfit'
jumpint(sb, ...)
## S3 method for class 'jumpint'
points(x, pch.left = NA, pch.right = NA, y.left = NA, y.right = NA, xpd = NA, ...)
confband(sb, ...)
## S3 method for class 'stepfit'
confband(sb, ...)
## S3 method for class 'confband'
lines(x, dataspace = TRUE, ...)

Arguments

sb

the result of a fit by stepbound

x

the object

pch.left, pch.right

the plotting character to use for the left/right end of the interval with defaults "(" and "]" (see parameter pch of par)

y.left, y.right

at which height to plot the interval boundaries with default par()$usr[3]

xpd

see par

dataspace

logical determining whether the expected value should be plotted instead of the fitted parameter value, useful e.g. for family = "binomial", where it will plot the fitted success probability times the number of trials per observation

...

arguments to be passed to generic methods

Value

For jumpint an object of class jumpint, i.e. a data.frame whose columns rightEndLeftBound and rightEndRightBound specify the left and right end of the confidence interval for the block's right end, resp., given the number of blocks was estimated correctly, and similarly columns rightIndexLeftBound and rightIndexRightBound specify the left and right indices of the confidence interval, resp. Function points plots these intervals on the lower horizontal axis (by default).

For confband an object of class confband, i.e. a data.frame with columns lower and upper specifying a confidence band computed at every point x; this is a simultaneous confidence band assuming the true number of jumps has been determined. Function lines plots the confidence band.

Note

Observe that jumps may occur immediately before or after an observed x; this lack of knowledge is reflected in the visual impressions by the lower and upper envelopes jumping vertically early, so that possible jumps between xs remain within the band, and by the confidence intervals starting immediately after the last x for which there cannot be a jump, cf. the note in the help for stepblock.

See Also

stepbound, points, lines

Examples

# simulate Bernoulli data with four blocks
y <- rbinom(200, 1, rep(c(0.1, 0.7, 0.3, 0.9), each=50))
# fit step function
sb <- stepbound(y, family="binomial", param=1, confband=TRUE)
plot(y, pch="|")
lines(sb)
# confidence intervals for jumps
jumpint(sb)
points(jumpint(sb), col="blue")
# confidence band
confband(sb)
lines(confband(sb), lty=2, col="blue")

stepR documentation built on Nov. 14, 2023, 1:09 a.m.