test.par(Y, alpha = 0.05, null_hyp = c("rw", "ar1"),
ar1test = c("lr", "kpss"), robust = FALSE)
par.fit
object produced by a
previous call to fit.par
which.hypothesis.partest
.
Default: 0.05."rw"
"ar1"
"partest"
"kpss"
"lr"
TRUE
Y
(or a previously fitted model is
re-used if Y
is an object of class par.fit
), representing the alternative
hypothesis. The null models specified by null_hyp
are also fit. The likelihood
ratio test is then used to determine whether or not the null model(s) should be rejected.
Statistics are output containing the test results.If "ar1"
is included in null_hyp
and ar1test = "kpss"
, then the
unit root test of Kwiatkowski, Phillips, Schmidt and Shin is used in place of the
likelihood ratio test to reject the null hypothesis that Y
is a pure AR(1)
sequence.
An example invocation of this function is as follows:
> test.par(x) Test of [Random Walk or AR(1)] vs Almost AR(1) [LR test for AR1]
data: x
Hypothesis Statistic p-value Random Walk -0.62 0.476 AR(1) -0.11 0.062 Combined 0.380
In this invocation, x
is tested against the null hypothesis that
it is either a pure random walk or a pure AR(1) series. The test of the
random walk null hypothesis produces a likelihood ratio score of -0.62,
which has a corresponding p-value of 0.476. The test of the AR(1)
null nypothesis produces a likelihood ratio score of -0.11, which has
a corresponding p-value of 0.062. The p-value for the combined test
representing the union of these two conditions is 0.38. Thus, the
null hypothesis cannot be rejected.
fit.par
which.hypothesis.partest
set.seed(1)
x <- rpar(1000, 0.8, 1, 1)
test.par(x)
Run the code above in your browser using DataLab