Learn R Programming

BreakPoints (version 1.2)

SNHT: Buishand Range Test and Standard Normal Homogeneity Test

Description

Compute Buishand Range Test or Standard Normal Homogeneity Test for a serie, NAs allow in both Test

Usage

SNHT(serie,n_period=10,dstr='norm',simulations = 1000,
                  seed_set = 9658, change_random_seed = TRUE)

Buishand_R(serie,n_period=10,dstr='norm',simulations = 1000, seed_set = 9658, change_random_seed = TRUE)

Arguments

serie

numeric vector where the breakpoint is looked for

n_period

an integer specifying the minimal length of a complete period to consider

dstr

character specifying which distribution should be used for test simulations, 'norm' (default; normal distribution), 'gamma', and 'self' (will compute bootstrap)

simulations

an integer specifying how many Monte Carlo simulations to perform, default is 1000.

seed_set

Either a number to used to set a seed or NULL to set no seed inside the function

change_random_seed

Logical, can the .Random.seed change inside the function, or must remain the same after applying the function

Value

SNHT and Buishand_R returns a list with the breakpoint index and it's p value

breaks

index where the breakpoint is found

p.value

p value of the test

Details

SNHT compute Standard Normal Homogeneity Test where NA values are allow. In order to guarantee same result for the same input seed_set must be given.

Buishand_R Compute Buishand Range Test for Homogeneity where NA values are allow. In order to guarantee same result for the same input seed_set must be given.

References

- Alexandersson, H., jan 1986. A homogeneity test applied to precipitation data. Journal of Climatology 6 (6), 661<U+2013>675. URL http://doi.wiley.com/10.1002/joc.3370060607

- Buishand, T., aug 1982. Some methods for testing the homogeneity of rainfall records. Journal of Hydrology 58 (1-2), 11<U+2013>27. URL https://doi.org/10.1016/0022-1694(82)90066-X

Examples

Run this code
# NOT RUN {
  # Make a serie with one breakpoint
  x <- c(rnorm(60,1,1),rnorm(40,2,1))

  # Look for break using SNHT, Buishand_R can be used in exactly the same way
  break_prosition <- SNHT(serie = x)

  plot(x)
  abline(v = break_prosition$breaks)
# }

Run the code above in your browser using DataLab