gr_test_vars: Test hydrograph changes

View source: R/test.R

gr_test_varsR Documentation

Test hydrograph changes

Description

Use this function to test interannual changes or hydrograph separation variables returned by gr_summarize(). Pettitt test is used to detect the change year — i.e. the year which divides the time series into the statistically most differing samples. Student (Welch) and Fisher tests are used to estimate the significance of mean and variance differences of these samples. Theil-Sen test calculates the trend slope value. Mann-Kendall test is performed to reveal the significance of the trend.

Usage

gr_test_vars(df, ..., year = NULL, exclude = NULL)

Arguments

df

data.frame as produced by gr_summarize() function.

...

Names of the tested variables (quoted).

year

Integer value of year used to divide series in two samples compared by Student and Fisher tests. Defaults to NULL which means that the year is calculated automatically by Pettitt test.

exclude

Integer vector of years to be excluded from tests.

Details

Number of observations formally required for various tests: Pettitt > 0, Mann-Kendall > 2, Theil-Sen > 1, Student > 1, Fisher > 1.

Value

list of testing results with following elements:

Element Description
ptt Pettitt tests for change year
mkt Mann-Kendall test for trend significance
tst Theil-Sen test for slope estimation
ts_fit Theil-Sen linear model fit
tt Student (Welch) test for significance of mean differences between two periods
ft Fisher test for significance of variance differences between two periods
year Integer value of year used to divide series in two samples compared by Student and Fisher tests
maxval Maximum value for the variable along the full time series
fixed_year Boolean TRUE or FALSE value indicating if the year was fixed
pvalues p-values of all tests summarized as a single table for all variables

Examples

library(grwat)

data(spas) # example Spas-Zagorye data is included with grwat package

# separate
sep = gr_separate(spas, params = gr_get_params(reg = 'center'))

# summarize from 1965 to 1990
vars = gr_summarize(sep, 1965, 1990)

# test all variables
tests = gr_test_vars(vars)

# view Pettitt test for Qygr
tests$ptt$Qygr

# view Fisher test for Q30s
tests$ft$Q30s

# test only Qygr and Q30s using 1978 as fixed year and excluding 1988-1991 yrs
gr_test_vars(vars, Qygr, Q30s, year = 1978, exclude = 1981:1983)

grwat documentation built on Nov. 2, 2023, 5:21 p.m.