ADF: ADF Test

Description Usage Arguments Value Examples

Description

Conduct an ADF test and automatically find the first difference if the variable is non-stationary.

Usage

1
ADF(my_var, df, type = "type2", time_var)

Arguments

my_var

The variable to be tested, with the null hypothesis stationary (random walk) and the alternative as non-stationary.

df

The data frame where the variable is contained, e.g. my_dataframe.

type

The three types are "no constant, no trend", "constant, no trend" and "constant, trend". The default is "type2", but there is also "type1" and "type3".

time_var

If the supplied data frame has previously been converted to time series using make_ts and/or the "zoo" package, then a time variable must be specified. The variable in the dataset which marks the year of the observations. E.g. "year"

Value

The result of the ADF test, and the first difference of the variable if it is stationary

Examples

1
2
3
4
file = system.file("extdata", "hseinv.txt", package="Kenometrics")
data <- read.delim(file)
data <- ADF("linvpc", data)
data <- ADF("lpop", data, type="type1")

pointonjoel/Kenometrics documentation built on Jan. 24, 2021, 6:05 a.m.