Learn R Programming

ffaframework (version 0.1.1)

eda_sens_trend: Sen's Trend Estimator

Description

Computes Sen's linear trend estimator for a univariate time series. The estimated slope and y-intercept are given in terms of the data and the covariate (time), which is derived from the years using the formula \((\text{Years} - 1900) / 100\).

Usage

eda_sens_trend(data, years)

Value

A list containing the estimated trend:

  • data: The data argument.

  • years: The years argument.

  • slope: The estimated slope.

  • intercept: The estimated y-intercept.

  • residuals: Vector of differences between the predicted and observed values.

Arguments

data

Numeric vector of observed annual maximum series values. Must be strictly positive, finite, and not missing.

years

Numeric vector of observation years corresponding to data. Must be the same length as data and strictly increasing.

Details

Sen's slope estimator is a robust, nonparametric trend estimator based on the median of all pairwise slopes between data points. The corresponding intercept is the median of each \(y_i - mx_i\) where \(m\) is the estimated slope.

References

Sen, P.K. (1968). Estimates of the regression coefficient based on Kendall's tau. Journal of the American Statistical Association, 63(324), 1379–1389.

See Also

eda_runs_test(), plot_ams_data()

Examples

Run this code
data <- rnorm(n = 100, mean = 100, sd = 10)
years <- seq(from = 1901, to = 2000)
eda_sens_trend(data, years)

Run the code above in your browser using DataLab