score.test {RecordTest} | R Documentation |
Score Test for the Likelihood of the Record Indicators
Description
This function performs score (or Lagrange multiplier) tests
for the likelihood of the record indicators to study the
hypothesis of the classical record model (i.e., of IID continuous RVs).
Usage
score.test(
X,
record = c("upper", "lower"),
alternative = c("two.sided", "greater", "less"),
probabilities = c("different", "equal"),
simulate.p.value = FALSE,
B = 1000
)
Arguments
X |
A numeric vector, matrix (or data frame). |
record |
A character string indicating the type of record, "upper" or "lower". |
alternative |
A character indicating the alternative hypothesis
( |
probabilities |
A character indicating if the alternative hypothesis
assume all series with |
simulate.p.value |
Logical. Indicates whether to compute p-values by Monte Carlo simulation. |
B |
An integer specifying the number of replicates used in the Monte Carlo estimation. |
Details
The null hypothesis of the score tests is that in every vector
(columns of the matrix X
), the probability of record at
time is
as in the classical record model, and
the alternative depends on the
alternative
and probabilities
arguments. The probability at time is any value, but equal in the
series if
probabilities = "equal"
or different in the
series if
probabilities = "different"
. The alternative
hypothesis is more specific in the first case than in the second one.
Furthermore, the "two.sided"
alternative
is tested with
the usual Lagrange multiplier statistic, while the one-sided
alternatives
use specific statistics based on scores.
(See Cebrián, Castillo-Mateo and Asín (2022) for details on these tests.)
If alternative = "two.sided" & probabilities = "equal"
, under the
null, the Lagrange multiplier statistic has an asymptotic
distribution with
degrees of freedom. It has been seen that for
the approximation to be adequate
should be greater than
.
Otherwise, a
simulate.p.value
can be computed.
If alternative = "two.sided" & probabilities = "different"
, the
asymptotic behaviour of the Lagrange multiplier statistic is not
fulfilled, but the Monte Carlo approach to simulate the p-value is
applied.
If alternative
is one-sided and probabilities = "equal"
,
the statistic of the test is
The p-value of this test is estimated with Monte Carlo simulations,
since the compute the exact distribution of is very
expensive.
If alternative
is one-sided and probabilities = "different"
,
the statistic of the test is
which is asymptotically standard normal distributed in . It is
equivalent to the statistic of the weighted number of records
N.test
with weights
.
Value
A list of class "htest"
with the following elements:
statistic |
Value of the statistic. |
parameter |
Degrees of freedom of the approximate |
p.value |
P-value. |
method |
A character string indicating the type of test. |
data.name |
A character string giving the name of the data. |
alternative |
A character string indicating the alternative hypothesis. |
Author(s)
Jorge Castillo-Mateo
References
Cebrián AC, Castillo-Mateo J, Asín J (2022). “Record Tests to Detect Non Stationarity in the Tails with an Application to Climate Change.” Stochastic Environmental Research and Risk Assessment, 36(2), 313-330. doi:10.1007/s00477-021-02122-w.
See Also
Examples
set.seed(23)
# two-sided and different probabilities of record, always simulated the p-value
score.test(ZaragozaSeries, probabilities = "different")
# equal probabilities
score.test(ZaragozaSeries, probabilities = "equal")
# equal probabilities with simulated p-value
score.test(ZaragozaSeries, probabilities = "equal", simulate.p.value = TRUE)
# one-sided and different probabilities of record
score.test(ZaragozaSeries, alternative = "greater", probabilities = "different")
# different probabilities with simulated p-value
score.test(ZaragozaSeries, alternative = "greater", probabilities = "different",
simulate.p.value = TRUE)
# equal probabilities, always simulated the p-value
score.test(ZaragozaSeries, alternative = "greater", probabilities = "equal")