Learn R Programming

RecordTest (version 2.2.0)

global.test: Global Statistic for Two-Sided Tests

Description

Performs a more powerful generalisation of the two-sided tests in this package by means of the sum of the statistics of upper and lower records in the forward and backward directions to study the hypothesis of the classical record model (i.e., of IID continuous RVs). The tests considered are the chi-square goodness-of-fit test p.chisq.test, the regression test p.regression.test, the likelihood-ratio test lr.test, and the score test score.test.

Usage

global.test(X, FUN, record = c(FU = 1, FL = 1, BU = 1, BL = 1), B = 1000, ...)

Value

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

statistic

Value of the statistic.

p.value

Simulated p-value.

method

A character string indicating the type of test.

data.name

A character string giving the name of the data.

Arguments

X

A numeric vector, matrix (or data frame).

FUN

One of the functions whose statistic is going to be used. One of p.chisq.test, p.regression.test, lr.test or score.test.

record

Logical vector. Vector with four elements indicating if forward upper, forward lower, backward upper and backward lower are going to be shown, respectively. Logical values or 0,1 values are accepted.

B

An integer specifying the number of replicates used in the Monte Carlo approach.

...

Further arguments in the FUN function.

Author

Jorge Castillo-Mateo

Details

The statistics, say \(X\), of the tests p.chisq.test, p.regression.test, lr.test or score.test applied to the series of the forward upper, forward lower, backward upper and backward lower records are summed to develop a more powerful statistic: $$X^{(FU)} + X^{(FL)} + X^{(BU)} + X^{(BL)}.$$ Other sums of statistics are allowed.

The distribution of this global statistics is unknown, but the p-value can be estimated with Monte Carlo simulations

See Also

p.chisq.test, p.regression.test, lr.test, score.test

Examples

Run this code
# not run because the simulations take a while if B > 1000
## global statistic with 4 types of record for p.chisq.test
#global.test(ZaragozaSeries, FUN = p.chisq.test)
## global statistic with 4 types of record for p.regression.test
#global.test(ZaragozaSeries, FUN = p.regression.test)
## global statistic with 4 types of record for score.test with restricted alternative
#global.test(ZaragozaSeries, FUN = score.test, probabilities = "equal")
## global statistic with 4 types of record for lr.test with restricted alternative
#global.test(ZaragozaSeries, FUN = lr.test, probabilities = "equal")
## global statistic with 2 types of 'almost' independent records for lr.test
#global.test(ZaragozaSeries, FUN = lr.test, record = c(1,0,0,1), probabilities = "different")

Run the code above in your browser using DataLab