Computes piecewise constant maximum likelihood estimators with minimal number of jumps under given restrictions on subintervals.
Deprecation warning: This function is a help function for smuceR
and jsmurf
and may be removed when these function will be removed.
stepbound(y, bounds, …)
# S3 method for default
stepbound(y, bounds, x = 1:length(y), x0 = 2 * x[1] - x[2],
max.cand = NULL, family = c("gauss", "gaussvar", "poisson", "binomial", "gaussKern"),
param = NULL, weights = rep(1, length(y)), refit = y,
jumpint = confband, confband = FALSE, …)
# S3 method for stepcand
stepbound(y, bounds, refit = TRUE, …)
a vector of numerical observations
bounds on the value allowed on intervals; typically computed with bounds
a numeric vector of the same length as y
containing the corresponding sample points
a single numeric giving the last unobserved sample point directly before sampling started
see stepcand
specifies distribution of data, see family
logical
, for family = "gaussKern"
; determines whether a fit taken the filter kernel into account will be computed at the end
logical
(FALSE
by default), indicates if confidence sets for jumps should be computed
logical
, indicates if a confidence band for the piecewise-continuous function should be computed
arguments to be passed to generic methods
An object of class stepfit
that contains the fit; if jumpint == TRUE
function jumpint
allows to extract the confidence interval for the jumps, if confband == TRUE
function confband
allows to extract the confidence band.
Frick, K., Munk, A., and Sieling, H. (2014) Multiscale change-point inference. With discussion and rejoinder by the authors. Journal of the Royal Statistical Society, Series B 76(3), 495--580.
Hotz, T., Sch<U+00FC>tte, O., Sieling, H., Polupanow, T., Diederichsen, U., Steinem, C., and Munk, A. (2013) Idealizing ion channel recordings by a jump segmentation multiresolution filter. IEEE Transactions on NanoBioscience 12(4), 376--386.
# NOT RUN {
# simulate poisson data with two levels
y <- rpois(100, c(rep(1, 50), rep(4, 50)))
# compute bounds
b <- bounds(y, penalty="len", family="poisson", q=4)
# fit step function to bounds
sb <- stepbound(y, b, family="poisson", confband=TRUE)
plot(y)
lines(sb)
# plot confidence intervals for jumps on axis
points(jumpint(sb), col="blue")
# confidence band
lines(confband(sb), lty=2, col="blue")
# }
Run the code above in your browser using DataLab