Learn R Programming

parameters (version 0.5.0)

smoothness: Quantify the smoothness of a vector

Description

Quantify the smoothness of a vector

Usage

smoothness(x, method = "cor", lag = 1)

Arguments

x

Numeric vector (similar to a time series).

method

Can be "diff" (the standard deviation of the standardized differences) or "cor" (default, lag-one autocorrelation).

lag

An integer indicating which lag to use. If less than 1, will be interpreted as expressed in percentage of the length of the vector.

Value

Value of smoothness.

References

https://stats.stackexchange.com/questions/24607/how-to-measure-smoothness-of-a-time-series-in-r

Examples

Run this code
# NOT RUN {
x <- (-10:10)^3 + rnorm(21, 0, 100)
plot(x)
smoothness(x, method = "cor")
smoothness(x, method = "diff")
# }

Run the code above in your browser using DataLab