Learn R Programming

stepR (version 2.1-10)

jumpint: 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 stepfit
jumpint(sb, ...)
# S3 method for jumpint
points(x, pch.left = NA, pch.right = NA, y.left = NA, y.right = NA, xpd = NA, ...)
confband(sb, ...)
# S3 method for stepfit
confband(sb, ...)
# S3 method for confband
lines(x, dataspace = TRUE, ...)

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.

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

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