ch_binned_MannWhitney {CSHShydRology} | R Documentation |
Compares two time periods of data using the Mann-Whitney test.
Data are binned based upon a bin size, and data are extracted for two time periods
and tests for change between two such periods
result can be passed to ch_polar_plot
or ch_decades_plot
for visualization.
ch_binned_MannWhitney(
DF,
step,
range1,
range2,
ptest = 0.05,
variable = "discharge",
metadata = NULL
)
DF |
A data frame of hydrometric data from |
step |
An integer indicating the degree of smoothing eg. 1, 5, 11. |
range1 |
The first and last year of first period, as |
range2 |
The first and last year of second period, as |
ptest |
The significance level default is |
variable |
Name of variable. Default is discharge |
metadata |
dataframe of station metadata, default is HYDAT_list |
Returns a list containing:
StationID |
ID of station |
Station_lname |
Name of station |
bin_width |
Smoothing time step |
range1 |
First range of years |
range2 |
Second range of years |
p_used |
p_value |
fail |
TRUE if test failed due to missing values |
bin_method |
method used for binning |
test_method |
Mann-Whitney U-statistic |
series |
a data frame containing: |
period |
period numbers i.e. 1:365/step |
period1 |
median values for each bin in period 1 |
period2 |
median values for each bin in period 2 |
mwu |
Mann-Whitney U-statistic for each bin between the two periods |
prob |
probability of U-statistic for each period |
code |
significance codes for each bin |
Paul Whitfield
Whitfield, P.H., Cannon, A.J., 2000. Recent variations in climate and hydrology in Canada. Canadian Water Resources Journal 25: 19-65.
ch_polar_plot
ch_polar_plot_prep
ch_decades_plot
data(HYDAT_list)
data(CAN05AA008)
# first example fails due to missing data in both periods
range1 <- c(1960,1969)
range2 <- c(1990,1999)
b_MW <- ch_binned_MannWhitney(CAN05AA008, step = 5, range1, range2, ptest = 0.05)
range1 <- c(1970,1979)
range2 <- c(1990,1999)
b_MW <- ch_binned_MannWhitney(CAN05AA008, step = 5, range1, range2, ptest = 0.05)