Learn R Programming

MultivariateTrendAnalysis (version 0.1.3)

srUnivariate: Univariate Spearman's Rho Test

Description

The functions performs the univariate Spearman's rho test.

Usage

srUnivariate(x)

Value

A named list

  • statistic, the estimated Spearman's rho test statistics

  • p.value, the estimated p-value for the test.

Arguments

x

Numeric vector representing a data series.

Details

The Spearman's Rank test is a non-parametric trend test based on rank-order, It tests a null hypothesis of no trend against an alternative. Given a data series \(X = (x_1, x_2, ..., x_n)\) of length \(n\), the test statistic is given by $$ D = 1 - \frac{6 \sum_{i=1}^n [R(x_i) - i]^2}{n(n^2 - 1)} $$ where \(R(x_i)\) is the rank of the i-th observation in the data series.

Under the null hypothesis D has asymptotically normal distribution, with \(E(D)=0\), and variance $$ \text{Var}(D) = \frac{1}{n-1} $$

References

  • Sneyers, R., 1990. On the Statistical Analysis of Series of Observations. World Meteorol. Organ.

Examples

Run this code
# Sample data (Both marginal distributions have trend):
dataMarginalTrend <- generate_data("marginalTrend", n = 50)

# Perform SR test on sample data:
srUnivariate(dataMarginalTrend[, 1])

srUnivariate(dataMarginalTrend[, 2])

Run the code above in your browser using DataLab