ch_binned_MannWhitney {CSHShydRology}R Documentation

Compares two time periods of data using Mann-Whitney test

Description

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.

Usage

ch_binned_MannWhitney(
  DF,
  step,
  range1,
  range2,
  ptest = 0.05,
  variable = "discharge",
  metadata = NULL
)

Arguments

DF

A data frame of hydrometric data from ch_read_ECDE_flows

step

An integer indicating the degree of smoothing eg. 1, 5, 11.

range1

The first and last year of first period, as c(first,last)

range2

The first and last year of second period, as c(first,last)

ptest

The significance level default is 0.05.

variable

Name of variable. Default is discharge

metadata

dataframe of station metadata, default is HYDAT_list

Value

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

Author(s)

Paul Whitfield

References

Whitfield, P.H., Cannon, A.J., 2000. Recent variations in climate and hydrology in Canada. Canadian Water Resources Journal 25: 19-65.

See Also

ch_polar_plot ch_polar_plot_prep ch_decades_plot

Examples

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)


[Package CSHShydRology version 1.3.0 Index]