Performs Foster-Stuart, Diersen-Trenkler and Cebri<U+00E1>n-Castillo-As<U+00ED>n records tests for trend in location, variation or the tails. The hypothesis of the classical record model (i.e., of randomness) is tested against the alternative hypothesis.
foster.test(
X,
weights = function(t) 1,
statistic = c("D", "d", "S", "s", "U", "L", "W"),
distribution = c("normal", "t"),
alternative = c("greater", "less"),
correct = FALSE,
simulate.p.value = FALSE,
B = 1000
)
A numeric vector, matrix (or data frame).
A function indicating the weight given to the different
records according to their position in the series,
e.g., if function(t) t-1
then \(\omega_t = t-1\).
A character string indicating the type of statistic to be
calculated, i.e., one of "D"
, "d"
, "S"
, "s"
,
"U"
, "L"
or "W"
(see Details).
A character string indicating the asymptotic
distribution of the statistic, "normal"
or Student's
"t"
distribution.
A character string indicating the type of alternative
hypothesis, "greater"
number of records or "less"
number of
records.
Logical. Indicates, whether a continuity correction
should be done; defaults to FALSE
. No correction is done if
simulate.p.value = TRUE
.
Logical. Indicates whether to compute p-values by Monte Carlo simulation.
If simulate.p.value = TRUE
, an integer specifying the
number of replicates used in the Monte Carlo estimation.
A "htest"
object with elements:
Value of the test statistic.
(If distribution = "t"
) Degrees of freedom of
the \(t\) statistic (equal to \(M-1\)).
P-value.
The alternative hypothesis.
(If distribution = "normal"
) A vector with the
value of the statistic, \(\mu\) and \(\sigma^2\).
A character string indicating the type of test performed.
A character string giving the name of the data.
In this function, the tests are implemented as given by Foster and Stuart (1954), Diersen and Trenkler (1996, 2001) and some modifications in the standardization of the previous statistics given by Cebri<U+00E1>n, Castillo-Mateo and As<U+00ED>n (2021). The null hypothesis is that the data come from a population with independent and identically distributed realizations. The one-sided alternative hypothesis is that the chosen statistic is greater (or less) than under the null hypothesis. The different statistics are calculated according to:
If statistic == "d"
,
$$\sum_{m=1}^{M} \sum_{t=1}^{T} \omega_t \left( I_{tm}^{(FU)} - I_{tm}^{(FL)}\right).$$
If statistic == "D"
,
$$\sum_{m=1}^{M} \sum_{t=1}^{T} \omega_t \left( I_{tm}^{(FU)} - I_{tm}^{(FL)} - I_{tm}^{(BU)} + I_{tm}^{(BL)}\right).$$
If statistic == "s"
,
$$\sum_{m=1}^{M} \sum_{t=1}^{T} \omega_t \left( I_{tm}^{(FU)} + I_{tm}^{(FL)}\right).$$
If statistic == "S"
,
$$\sum_{m=1}^{M} \sum_{t=1}^{T} \omega_t \left( I_{tm}^{(FU)} + I_{tm}^{(FL)} + I_{tm}^{(BU)} + I_{tm}^{(BL)}\right).$$
If statistic == "U"
,
$$\sum_{m=1}^{M} \sum_{t=1}^{T} \omega_t \left( I_{tm}^{(FU)} - I_{tm}^{(BU)}\right).$$
If statistic == "L"
,
$$\sum_{m=1}^{M} \sum_{t=1}^{T} \omega_t \left( I_{tm}^{(BL)} - I_{tm}^{(FL)}\right).$$
If statistic == "W"
,
$$\sum_{t=1}^{T} \omega_t \left( I_{tm}^{(FU)} + I_{tm}^{(BL)}\right).$$
Where \(\omega_t\) are weights given to the different records
according to their position in the series, \(I_{tm}\) are the record
indicators (see I.record
), and \((FU)\), \((FL)\),
\((BU)\) and \((BL)\) represents forward upper, forward lower,
backward upper and backward lower records, respectively. The statistics
\(d\), \(D\) and \(W\) may be used for trend in location;
\(s\) and \(S\) may be used for trend in variation; and \(U\) and
\(L\) may be used for trend in the upper and lower tails of the
distribution respectively.
The statistics, say \(X\), are approximately normally distributed, with $$Z = \frac{X - \mu}{\sigma},$$ while the mean \(\mu\) of the particular statistic considered is simple to calculate, its variance \(\sigma^2\) become a cumbersome expression and some are given by Diersen and Trenkler (2001) and all of them can be computed out of the expression of the covariances given by Cebri<U+00E1>n, Castillo-Mateo and As<U+00ED>n (2021).
If correct = TRUE
, then a continuity correction will be employed:
$$Z = \frac{X \pm 0.5 - \mu}{\sigma},$$
with ``\(-\)'' if the alternative is greater and ``\(+\)'' if the
alternative is less. Not recommended for the statistics with \(\mu=0\).
When \(M>1\), the expression of the variance under the null hypothesis can be substituted by the sample variance in the \(M\) series, \(\hat{\sigma}^2\). In this case, the statistics are asymptotically \(t\) distributed, which is a more robust alternative against serial correlation.
If simulate.p.value = TRUE
, the p-value is estimated by Monte Carlo
simulations.
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.
Diersen J, Trenkler G (1996). <U+201C>Records Tests for Trend in Location.<U+201D> Statistics, 28(1), 1-12.
Diersen J, Trenkler G (2001). <U+201C>Weighted Records Tests for Splitted Series of Observations.<U+201D> In J Kunert, G Trenkler (eds.), Mathematical Statistics with Applications in Biometry: Festschrift in Honour of Prof. Dr. Siegfried Schach, pp. 163<U+2013>178. Lohmar: Josef Eul Verlag.
Foster FG, Stuart A (1954). <U+201C>Distribution-Free Tests in Time-Series Based on the Breaking of Records.<U+201D> Journal of the Royal Statistical Society. Series B (Methodological), 16(1), 1-22.
# NOT RUN {
# D-statistic
foster.test(ZaragozaSeries)
# D-statistic with linear weights
foster.test(ZaragozaSeries, weights = function(t) t-1)
# S-statistic with linear weights
foster.test(ZaragozaSeries, statistic = "S", weights = function(t) t-1)
# D-statistic with weights and t approach
foster.test(ZaragozaSeries, distribution = "t", weights = function(t) t-1)
# U-statistic with weights (upper tail)
foster.test(ZaragozaSeries, statistic = "U", weights = function(t) t-1)
# L-statistic with weights (lower tail)
foster.test(ZaragozaSeries, statistic = "L", weights = function(t) t-1)
# }
Run the code above in your browser using DataLab