TrendTest: Trend hypothesis test

View source: R/All.R

TrendTestR Documentation

Trend hypothesis test

Description

A hypothesis test for the correlation between the variable of interest and time

Usage

TrendTest(x, method = "kendall", alternative = "two.sided")

Arguments

x

a numeric vector or a data.frame with dates in the first column and chronologically ordered variable in the second.

method

a choice of test method. Choices are "pearson", "spearman", and "kendall"

alternative

the alternative hypothesis. The default is "two.sided". See details for other options

Details

The test can be performed on a numeric vector, or a data.frame with dates in the first column and the associated variable of interest in the second. A choice can be made between a Pearson's, Spearman's Rho or Kendall's tau test. The Spearman and Kendall are based on ranks and will therefore have the same results whether dates are included or not. The default is kendall (note: for very long time series the kendall method takes a touch longer). The default is to test for any trend (alternative = "two.sided"). For positive trend set alternative to "greater". And for negative trend, set it to "less"

Value

A data.frame with columns and associated values: P_value, correlation coefficient, and method specific statistic.

Author(s)

Anthony Hammond

Examples

#Get AMAX sample and apply a trend test with the default kendall test.
AM.27083 <- GetAM(27083)
TrendTest(AM.27083)
#Apply the test with the pearson method with dates included and not
TrendTest(AM.27083, method = "pearson")
TrendTest(AM.27083$Flow, method = "pearson")

UKFE documentation built on Nov. 6, 2023, 1:07 a.m.

Related to TrendTest in UKFE...