Learn R Programming

stepR (version 1.0-1)

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

Description

Extract and plot confidence intervals and bands from fits using stepbound.

Usage

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

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
...
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.

See Also

stepbound, points, lines

Examples

Run this code
# 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")

Run the code above in your browser using DataLab