Title: | Change-Points Detections for Changes in Variance |
---|---|
Description: | Detection of change-points for variance of heteroscedastic Gaussian variables with piecewise constant variance function. Adelfio, G. (2012), Change-point detection for variance piecewise constant models, Communications in Statistics, Simulation and Computation, 41:4, 437-448, <doi:10.1080/03610918.2011.592248>. |
Authors: | Gianluca Sottile [cre], Giada Adelfio [aut] |
Maintainer: | Gianluca Sottile <[email protected]> |
License: | GPL-2 |
Version: | 0.1.1 |
Built: | 2024-11-23 03:31:07 UTC |
Source: | https://github.com/cran/changepointsVar |
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. 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.
Package: | jumpointsVar |
Type: | Package |
Version: | 0.1.1 |
Date: | 2024-01-22 |
License: | GPL-2 |
The function jumpointsVar
allows to specify the variable in which to look for change-point in variance. The auxiliary function plot.jumpointsVar
can be used to plot the brekpoints detected from the main algorithm.
Giada Adelfio
Maintainer: Gianluca Sottile <[email protected]>
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 jumpointsVar documentation ----
##---- see jumpointsVar documentation ----
Auxiliary function as user interface for model fitting. Typically only used when calling 'jumpointsVar'
fit.control(toll=0.001, it.max=10, last=TRUE, scale.res=FALSE, maxit.glm=30, h=1, stop.if.error=FALSE)
fit.control(toll=0.001, it.max=10, last=TRUE, scale.res=FALSE, maxit.glm=30, h=1, stop.if.error=FALSE)
toll |
positive convergence tolerance. |
it.max |
integer giving the maximal number of iterations. |
last |
Currently ignored. |
scale.res |
logical indicating if the residuals have to be scaled. |
maxit.glm |
Currently ignored. |
h |
Currently ignored. |
stop.if.error |
logical indicating if the algorithm should stop when one or more estimated changepoints
do not assume admissible values. Default is |
A list with the arguments as components to be used by 'jumpointsVar'.
Gianluca Sottile Maintainer: Gianluca Sottile <[email protected]>
Detection of change-points for variance of heteroscedastic Gaussian variables with piecewise constant variance function.
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())
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())
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 |
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.
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 |
Giada Adelfio
Maintainer: Gianluca Sottile <[email protected]>
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.
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)
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)
Plots signal with changes in variance and corresponding changepoints
## S3 method for class 'jumpointsVar' plot(x, ...)
## S3 method for class 'jumpointsVar' plot(x, ...)
x |
object returned by jumpointsVar |
... |
additional arguments. |
This fuction takes a fitted object returned by jumpointsVar and plots the resulting fit with changepoints.
The function simply plot the fit returned by 'jumpointsVar'
Giada Adelfio
Maintainer: Gianluca Sottile <[email protected]>
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 jumpointsVar documentation ----
##---- see jumpointsVar documentation ----
Auxiliary function as user interface for model selection. Typically only used when calling 'jumpointsVar'
sel.control(type=c("bic", "rss"), S=1, Cn="2*log(log(n))", alg=c("lasso", "stepwise"), edf.psi=TRUE)
sel.control(type=c("bic", "rss"), S=1, Cn="2*log(log(n))", alg=c("lasso", "stepwise"), edf.psi=TRUE)
type |
the criterion to be used to perform model selection. |
S |
if |
Cn |
if |
alg |
which procedure should be used to perform model selection? The value of |
edf.psi |
logical indicating if the number of changepoints should be computed in the model df. |
This function specifies how to perform model seletion, namely how many change points should be selected.
A list with the arguments as components to be used by 'jumpointsVar' and in turn by 'lars'.
Gianluca Sottile Maintainer: Gianluca Sottile <[email protected]>