jumpointsVar {changepointsVar} | R Documentation |
Change-point detection for variance piecewise constant models
Description
Detection of change-points for variance of heteroscedastic Gaussian variables with piecewise constant variance function.
Usage
jumpointsVar(y, x, y.res=FALSE, k=min(30, round(length(y)/10)), print.level=0,
plot.it=FALSE, psi=NULL, round=TRUE, control=fit.control(),
selection=sel.control())
Arguments
y |
the response variable. |
x |
the 'segmented' variable; if missing simple indices 1,2,... are assumed. |
y.res |
logical:
if |
k |
the starting number of changepoints. It should be quite larger than the supposed number of (true) changepoints. This argument is ignored if starting values of the changepoints are specified via psi. |
print.level |
the default value is 0 indicating nothing is printed; 1 allows to print some informations during the algorithm; 2 the same as for 1 plus lars information. |
plot.it |
logical indicating if the curve of the criterion choosen has to be displayed. |
psi |
numeric vector to indicate the starting values for the changepoints. When |
round |
logical: if the change-point values should be rounded |
control |
a list returned by |
selection |
a list returned by |
Details
This algorithm allows breakpoint detections for changes in variation assuming that the variance function can be described by a piecewise constant function with segments delimited by unknown change-points.
The approach is a generalization of the cumSeg
procedure proposed by Muggeo and Adelfio (2011) assuming that testing for stepwise changes in variance of a sequence of Gaussian random variables may be transformed equivalently to the case of testing for changes in mean of the squared residuals (from an estimated linear model that accounts for the mean behavior of the observed signal) assuming a gamma GLM with a log-link function.
A variation of lars
procedure adapted to the GLM case is considered to discard the spurious change-points on the basis of a generalized version of the BIC.
The proposed approach results in a very efficient algorithm even with n large and many change-points to be estimated.
Value
An object of class jumpointsVar
. It's a list including several components:
psi |
the estimated changepoints |
est.means |
the estimated means |
n.psi |
the estimated number of changepoints |
psi0 |
the initial estimated changepoints (before applying the selection criterion) |
est.means0 |
the initial estimated means (before applying the selection criterion) |
criterion |
the curve of the selected criterion |
fitted.values |
the fitted values |
input |
the input parameters |
call |
the call function |
Author(s)
Giada Adelfio
Maintainer: Gianluca Sottile <gianluca.sottile@unipa.it>
References
Adelfio, G. (2012), Change-point detection for variance piecewise constant models, Communications in Statistics, Simulation and Computation, 41:4, 437-448
Muggeo, V.M.R., Adelfio, G. (2011) Efficient change point detection for genomic sequences of continuous measurements, Bioinformatics 27, 161-166.
See Also
Examples
set.seed(2)
n = 500
x = 1:n/n
mu = 10+6*sin(3*pi*x)
# if there are two change-points
sigma = c(rep(0.5,.2*n), rep(8,.4*n), rep(3,.4*n))
y = mu + rnorm(n, 0, sigma)
reg = lm(y ~ mu)
h = influence(reg)$hat
r2 = resid(reg)^2/(1-h) + 1
o = jumpointsVar(y=r2, y.res=TRUE, k=30)
o
plot(o)
# if there are no change-points
sigma = 0.5*x
y = mu + rnorm(n, 0, sigma)
reg = lm(y ~ mu)
h = influence(reg)$hat
r2 = resid(reg)^2/(1-h)+1
o = jumpointsVar(y=r2, y.res=TRUE, k=30)
plot(o)
# if the mean behavior of the observed signal is unkown
sigma = c(rep(0.5,.2*n), rep(8,.4*n), rep(3,.4*n))
y = 10 + rnorm(n, 0, sigma)
o = jumpointsVar(y=y, y.res=FALSE, k=30)
plot(o)