Estimate autoregressive distributed lag model, simulate interesting values, and plot predictions
dynardl(formula, data = list(), lags = list(), diffs = list(),
lagdiffs = list(), levels = list(), ec = FALSE, range = 20,
sig = 95, time = 10, shockvar = list(),
shockval = sd(data[[shockvar]]), sims = 1000, forceset = NULL,
burnin = 20, expectedval = FALSE, trend = FALSE, constant = TRUE,
graph = FALSE, rarea = TRUE, modelout = FALSE, simulate = TRUE)
a symbolic description of the model to be estimated. ARDL models are estimated using linear regression.
an optional data frame or list containing the the variables in the model.
a list of variables and their corresponding lags to be estimated.
a vector of variables to be differenced. Only first differences are supported.
a list of variables to be included in lagged differences.
a vector of variables to be included in levels.
estimate model in error-correction form, (i.e., y
appears
in first-differences). By default, ec
is set to FALSE
,
meaning y
will appear in levels.
the range of the simulation to be conducted
the significance level (1 - p
) that the user wants for
the simulations. The default level is 95% significance (sig = 95
).
the time period in the simulation for the variable to be shocked.
the variable to be shocked. There is no default.
the amount by which the shockvar
should be shocked.
The default is one standard deviation of the shocked variable.
the number of simulations to use in creating the quantities of interest. The default is 1000.
by default, in the simulations, variables in levels will be
set to their means; variables in differences will be set to 0.
Alternatively, users can set any variable in the model to a different value
using a list in forceset
.
the number of time periods to disregard before recording the
values. These do not include the range
; in other words, they take
place before the range
specified above. Users can increase the
number of burnin
periods, but probably should not decrease them. The
default is 20.
if this is TRUE
, the simulation will record the
expected values of across the sims
by averaging errors. We recommend
setting it to FALSE
, since expected values do not account for
stochastic error present in the model itself.
include a linear time trend. The default is FALSE.
include a constant. The default is TRUE.
create a plot of the simulated response. The default is FALSE.
if graph = TRUE
, create an area plot. If graph =
TRUE
and rarea = FALSE
, a spike plot will be created.
print the regression estimates in the console
simulate the reponse. Otherwise, just the regression model will be estimated.
dynardl
should always return an estimated model. It may or
may not be simulated, according to the user. But the relevant regression
output, model residuals (which can be tested for autocorrelation), and
simulated response (if created) are stored in a list if the model is
assigned to an object.
Estimate an auto-regressive distributed lag model. Moreover, provide a graphical interpretation of the results by simulating the response of the dependent variable to shocks in one of the regressors.
# NOT RUN {
# Using the inequality data from dynamac
ardl.model <- dynardl(concern ~ incshare10 + urate, data = ineq,
lags = list("concern" = 1, "incshare10" = 1),
diffs = c("incshare10", "urate"),
ec = TRUE, simulate = FALSE)
summary(ardl.model$model)
# Adding a lagged difference of the dependent variable
ardl.model.2 <- dynardl(concern ~ incshare10 + urate, data = ineq,
lags = list("concern" = 1, "incshare10" = 1),
diffs = c("incshare10", "urate"),
lagdiffs = list("concern" = 1),
ec = TRUE, simulate = FALSE)
summary(ardl.model.2$model)
# Does not work: levels must appear as a vector
ardl.model.3 <- dynardl(concern ~ incshare10 + urate, data = ineq,
lags = list("concern" = 1, "incshare10" = 1),
levels = list("urate" = 1),
diffs = c("incshare10", "urate"),
lagdiffs = list("concern" = 1),
ec = TRUE, simulate = FALSE)
ardl.model.3 <- dynardl(concern ~ incshare10 + urate, data = ineq,
lags = list("concern" = 1, "incshare10" = 1),
levels = c("urate"),
diffs = c("incshare10", "urate"),
lagdiffs = list("concern" = 1),
ec = TRUE, simulate = FALSE)
# }
Run the code above in your browser using DataLab