This function performs a chi-square goodness-of-fit test based on the record probabiliteis \(p_t\) to study the hypothesis of the classical record model (i.e., of IID continuous RVs).
p.chisq.test(
X,
record = c("upper", "lower"),
simulate.p.value = FALSE,
B = 1000
)
A "htest"
object with elements:
Value of the chi-squared statistic.
Degrees of freedom.
P-value.
A character string indicating the type of test performed.
A character string giving the name of the data.
A numeric vector, matrix (or data frame).
A character string indicating the type of record to be calculated, "upper" or "lower".
Logical. Indicates whether to compute p-values by Monte Carlo simulation. It is recommended if the function returns a warning (see Details).
If simulate.p.value = TRUE
, an integer specifying the
number of replicates used in the Monte Carlo estimation.
Jorge Castillo-Mateo
The null hypothesis of this chi-square test 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,
and the alternative that the probabilities are not equal to those values.
First, the chi-square goodness-of-fit statistics to study the null
hypothesis \(H_0:\,p_t = 1/t\) are calculated for each time
\(t=2,\ldots,T\), where the observed value is the number of records at
time \(t\) in the \(M\) vectors and the expected value under the null
is \(M / t\). The test statistic is the sum of the previous \(T-1\)
statistics and its distribution under the null
is approximately \(\chi^2_{T-1}\).
The chi-square approximation may not be valid with low \(M\), since it
requires expected values \(> 5\) or up to \(20\%\) of the expected
values are between 1 and 5. If this condition is not satisfied, a warning
is displayed. In order to avoid this problem, a simulate.p.value
can be made by means of Monte Carlo simulations.
Benestad RE (2003). “How Often Can We Expect a Record Event?” Climate Research, 25(1), 3-13. tools:::Rd_expr_doi("10.3354/cr025003").
Benestad RE (2004). “Record-Values, Nonstationarity Tests and Extreme Value Distributions.” Global and Planetary Change, 44(1-4), 11–26. tools:::Rd_expr_doi("10.1016/j.gloplacha.2004.06.002").
global.test
, score.test
,
p.record
, p.regression.test
,
lr.test
# Warning, M = 76 small for the value of T = 70
p.chisq.test(ZaragozaSeries)
# Simulate p-value
p.chisq.test(ZaragozaSeries, simulate.p.value = TRUE, B = 10000)
Run the code above in your browser using DataLab