Learn R Programming

grwat (version 0.0.4)

gr_test_vars: 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)

Value

list of testing results with following elements:

ElementDescription
pttPettitt tests for change year
mktMann-Kendall test for trend significance
tstTheil-Sen test for slope estimation
ts_fitTheil-Sen linear model fit
ttStudent (Welch) test for significance of mean differences between two periods
ftFisher test for significance of variance differences between two periods
yearInteger value of year used to divide series in two samples compared by Student and Fisher tests
maxvalMaximum value for the variable along the full time series
fixed_yearBoolean TRUE or FALSE value indicating if the year was fixed
pvaluesp-values of all tests summarized as a single table for all variables

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.

Examples

Run this code
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)

Run the code above in your browser using DataLab