Skip to contents

Runs an Augmented Dickey-Fuller test (H0: unit root / non-stationary) and a KPSS test (H0: stationary) via the urca package where available, plus a Ljung-Box autocorrelation test, and suggests a differencing order to achieve stationarity of the mean.

Usage

morie_ts_stationarity(x, max_d = 2L)

Arguments

x

A numeric series or morie_ts.

max_d

Maximum differencing to search for the suggestion.

Value

A morie_ts_stationarity list: adf, kpss (statistic + whether stationary at 5%), ljung_box p-value, and suggested_d.

Examples

morie_ts_stationarity(cumsum(rnorm(100)))$suggested_d
#> [1] 1