View source: R/tseries-stationarity.R
kpss_test | R Documentation |
The hypotheses for this test are:
A wrapper around tseries::kpss.test()
that standardizes the inputs and outputs.
kpss_test(object, null = "Level", ..., .alpha = 0.05)
## S3 method for class 'lm'
kpss_test(object, null = "Level", ..., .alpha = 0.05)
## S3 method for class ''_lm''
kpss_test(object, null = "Level", ..., .alpha = 0.05)
kpss_test_vec(x, null = "Level", ..., .alpha = 0.05)
object |
A model object (such as a fitted |
null |
(Optional) The null hypothesis, either "Level" (default) or "Trend". |
... |
Further arguments passed to |
.alpha |
(Optional) Critical p-value used to determine test conclusion. The default is 0.05 (5%). |
x |
For |
Null: Series is either Level or Trend stationary (user defined)
Alternative: Series has a unit root
A tibble with columns test
, statistic
,
p_value
, result
, outcome
, and .notes
with extra information.
Other stationarity tests:
aug_dickey_fuller_test()
,
phillips_perron_test()
library(tidytest)
#> `lm` Method
mod_lm_fit <- lm(mpg ~ disp + wt + hp, data = mtcars)
kpss_test(mod_lm_fit)
kpss_test(mod_lm_fit, null = "Trend")
#> `linear_reg` Method
library(parsnip)
mod_linreg_fit <- linear_reg() %>%
set_engine("lm") %>%
fit(mpg ~ disp + wt + hp, data = mtcars)
kpss_test(mod_linreg_fit)
kpss_test(mod_linreg_fit, null = "Trend")
#> Numeric Method
set.seed(1914)
resids <- rnorm(100)
kpss_test_vec(resids)
kpss_test_vec(resids, null = "Trend")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.