sim_df_mod | R Documentation |
sim_df_mod()
is designed as a helper function, to be used
internally in this package in sadf_test()
. But, you can use it here to
simulate a time series and perform a(n Augmented) Dickey-Fuller test.
sim_df_mod(x, ts_type, df_lags = NULL, classic_df = FALSE, wn = FALSE)
x |
a numeric vector corresponding to a series to replicate/simulate |
ts_type |
a type of time-series to simulate (either 'ndnt', 'dnt', or 'dt') |
df_lags |
a numeric vector for the number of lags to calculate for the test. |
classic_df |
logical, defaults to FALSE. If FALSE, the function calculates
an "Augmented" Dickey-Fuller test on a simulated series with the number of lagged
first differences requested in the |
wn |
logical, defaults to FALSE. If FALSE, generates a random walk of some description for a DF/ADF test. If TRUE, series to be simulated for a DF/ADF test is white noise. |
classic_df = TRUE
suppresses the need to specify df_lags = 0
, but
df_lags
cannot be 0 if classic_df = FALSE
.
This might change in future iterations, but it's worth clarifying the values assigned to the parameters of a drift and trend. The drift is randomly generated from a Rademacher distribution for both the times series with drift and drift-and-trend. The series with a deterministic trend divides the value from the Rademacher distribution by 10. My rationale is largely based on what I've seen other pedagogical guides do, the extent to which they talk about simulating values for these types of random walks.
sim_df_mod()
returns the output of a linear model (with class
lm
) that performs a(n Augmented) Dickey-Fuller test on a simulated time
series. This is mostly for internal use, but it might pique the user's
interest to see such a test in action independent of simulated summaries
generated by sadf_test()
.
Steven V. Miller
set.seed(8675309) # don't want new numbers in documentation every time...
sim_df_mod(rnorm(25), ts_type = 'ndnt', classic_df = TRUE)
sim_df_mod(rnorm(25), ts_type = 'ndnt', df_lags = 2, classic_df = FALSE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.