schapt {sac} | R Documentation |
Semiparametric empirical likelihood ratio based test of changepoint with one-change or epidemic alternatives with data-based model diagnostic
schapt(x, n.boots = 0, replace = FALSE, alternative = c("one.change", "epidemic"), conf.level = 0.95, adj.Wn = FALSE, model.test = FALSE, n.model.boots = 0, tol=1.0e-7, maxit=50,trace=FALSE,... )
x |
a numeric vector or matrix containing the data, one row per observation; |
n.boots |
number of bootstrap samples for bootstrap test of the change-point,
if n.boots =0 , do not perform bootstrap test; |
replace |
a logical indicating whether bootstrap samples for bootstrap test
of the change-point are selected with or without replacement, if replace = FALSE (default),
corresponds to permutation test, otherwise, bootstrap test; |
alternative |
a character string specifying the alternative hypothesis,
must be one of "one-change" (default) or "epidemic" . You can specify just the initial letter.
Epidemic alternative is also called square wave alternative in the literature. |
conf.level |
confidence level. |
adj.Wn |
logical indicating if Wn should be adjusted or not
for "epidemic" alternative. |
model.test |
a logical indicating whether the test of model validity is performed. |
n.model.boots |
number of bootstrap samples for model test, if either
n.model.boots = 0 or
model.test =FALSE, then model test will not be performed. |
tol |
the desired accuracy (convergence tolerance), an argument of glm.control . |
maxit |
the maximum number of iterations, an argument of glm.control . |
trace |
logical indicating if output should be produced for each
iteration, an argument of glm.control . |
... |
other future arguments |
Model: log{g(x)/f(x)}=exp{alpha+beta'T(x)}, where f(x) and g(x) are the density (frequency) functions of the two hypothesized populations, and T(x) can be chosen as T(x)=x or T(x)=(x,x^2). The procedure will fail when there is separation in the data in the sense of Albert \& Anderson(1984, Biometrika) and Santner \& Duffy (1986, Biometrika). In this case, the change-point(s) may be detected easily using nonparametric method based on cumsum. Currently, this function does not check whether the data is separated.
data.name |
dataset name |
parameter |
sample size n and degree(s) of freedom of the df of Sn for
"one-change" alternative |
alternative |
the alternative hypothesis |
statistic |
a list contains Sn for "one-change" alternative, Vn and Wn
for "epidemic" alternative;
also contains Delta if model test is performed |
estimate |
a list contains change-point(s) and alpha and beta |
p.value |
a list contains p -value(s), p(Sn) , of Sn for "one-change" alternative,
p(Vn) and p(Wn) , of Vn and Wn , repectively, for "epidemic" alternative;
also p.boots(model) of Delta if model test is performed, if bootstrap test(s) of the change-point(s)
are performed, the it also containts the
corresponding p -values, p.boots(Sn) , p.boots(Vn) and p.boots(Wn) accordingly. |
Statistic Wn
need be adjusted only for one dimensional observations
and if no bootstrap test is conducted. If returned p
-value is 0, this means that the
p
-value is less than 1.0e-7. There is an R package, called "strucchange"
, for testing structural
change in linear regression models (see sctest
).
Zhong Guan zguan@iusb.edu
Guan, Z. (2001). Some Results About Empirical Likelihood Method, Ph.D. Thesis, The University of Toledo.
Guan, Z.(2004) A semiparametric change-point model, Biometrika, 91, 4, 849–862.
Guan, Z. Semiparametric Tests for Change-points with Epidemic Alternatives.
require(sac) #load the package # one-change alternative ## Nile data with one change-point: the annual flows drop in 1898. ## It is believed to be caused by the building of the first Aswan dam. if(! "package:sac" %in% search()) library(sac) #if package sac has not been loaded, load it. if(! "package:stats" %in% search()) library(stats) data(Nile) plot(Nile, type="p") schapt(Nile, alternative = "one.change")