Learn R Programming

RecordTest (version 2.0.0)

lr.test: Likelihood-Ratio Test for the Likelihood of the Record Indicators

Description

This function performs likelihood-ratio tests for the likelihood of the record indicators \(I_t\) to study the hypothesis of the classical record model.

Usage

lr.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 ("two.sided", "greater" or "less"). Different statistics are used in the one-sided and two-sided alternatives (see Details).

probabilities

A character indicating if the alternative hypothesis assume all series with "equal" or "different" probabilities of record.

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.

Value

A list of class "htest" with the following elements:

statistic

Value of the statistic.

parameter

Degrees of freedom of the approximate \(\chi^2\) distribution.

p.value

(Estimated) 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.

Details

The null hypothesis of the likelihood-ratio tests is that in every vector (columns of the matrix X), the probability of record at time \(t\) is \(1 / t\) as in the classical record model (i.e., sequences of independent and identically distributed realizations), and the alternative depends on the alternative and probabilities arguments. The probability at time \(t\) is any value, but equal in the \(M\) series if probabilities = "equal" or different in the \(M\) 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 likelihood ratio statistic, while the one-sided alternatives use specific statistics based on likelihoods. (See Cebri<U+00E1>n, Castillo-Mateo and As<U+00ED>n (2021) for details on these tests.)

If alternative = "two.sided" & probabilities = "equal", under the null, the likelihood ratio statistic has an asymptotic \(\chi^2\) distribution with \(T-1\) degrees of freedom. It has been seen that for the approximation to be adequate \(M\) must be between 4 and 5 times greater than \(T\). Otherwise, a simulate.p.value is recommended.

If alternative = "two.sided" & probabilities = "different", the asymptotic behavior is not fulfilled, but the Monte Carlo approach to simulate the p-value is applied. This statistic is the same as \(\ell\) below multiplied by a factor of 2, so the p-value is the same.

If alternative is one-sided and probabilities = "equal", the statistic of the test is $$-2 \sum_{t=2}^T \left\{-S_t \log\left(\frac{tS_t}{M}\right)+(M-S_t)\left( \log\left(1-\frac{1}{t}\right) - \log\left(1-\frac{S_t}{M}\right) I_{\{S_t<M\}} \right) \right\} I_{\{S_t > M/t\}}.$$ The p-value of this test is estimated with Monte Carlo simulations, because the computation of its exact distribution is very expensive.

If alternative is one-sided and probabilities = "different", the statistic of the test is $$\ell = \sum_{t=2}^T S_{t} \log(t-1) - M \log\left(1-\frac{1}{t}\right).$$ The p-value of this test is estimated with Monte Carlo simulations. However, it is equivalent to the statistic of the weighted number of records N.test with weights \(\omega_t = \log(t-1)\) \((t=2,\ldots,T)\).

References

Cebri<U+00E1>n A, Castillo-Mateo J, As<U+00ED>n J (2021). <U+201C>Record Tests to detect non stationarity in the tails with an application to climate change.<U+201D> Unpublished manuscript.

See Also

global.test, score.test

Examples

Run this code
# NOT RUN {
set.seed(23)
# two-sided and different probabilities of record, always simulated the p-value
lr.test(ZaragozaSeries, probabilities = "different")
# equal probabilities
lr.test(ZaragozaSeries, probabilities = "equal")
# equal probabilities with simulated p-value
lr.test(ZaragozaSeries, probabilities = "equal", simulate.p.value = TRUE)

# one-sided and different probabilities of record
lr.test(ZaragozaSeries, alternative = "greater", probabilities = "different")
# different probabilities with simulated p-value
lr.test(ZaragozaSeries, alternative = "greater", probabilities = "different", 
  simulate.p.value = TRUE)
# equal probabilities, always simulated the p-value
lr.test(ZaragozaSeries, alternative = "greater", probabilities = "equal")
# }

Run the code above in your browser using DataLab