
Evaluate (and possibly plot) the General Dynamic Response Function (GDRF) for a Generalized Error Correction Model (GECM)
Source:R/tseffects.R
GDRF.gecm.plot.RdEvaluate (and possibly plot) the General Dynamic Response Function (GDRF) for a Generalized Error Correction Model (GECM)
Usage
GDRF.gecm.plot(
model = NULL,
x.vrbl = NULL,
y.vrbl = NULL,
x.vrbl.d.x = NULL,
y.vrbl.d.y = NULL,
x.d.vrbl = NULL,
y.d.vrbl = NULL,
x.d.vrbl.d.x = NULL,
y.d.vrbl.d.y = NULL,
shock.history = "pulse",
inferences.y = "levels",
inferences.x = "levels",
effect.type = "marginal",
prediction.values = NULL,
baseline.y = NULL,
baseline.y.se = 0,
shock.size = 1,
dM.level = 0.95,
s.limit = 20,
se.type = "const",
return.data = FALSE,
return.plot = TRUE,
return.formulae = FALSE,
...
)Arguments
- model
the
lmmodel containing the GECM estimates- x.vrbl
a named numeric vector of the x variables (of the lower level of differencing, usually in levels d = 0) and corresponding lag orders in the GECM model
- y.vrbl
a named numeric vector of the (lagged) y variables (of the lower level of differencing, usually in levels d = 0) and corresponding lag orders in the GECM model
- x.vrbl.d.x
the order of differencing of the x variable (of the lower level of differencing, usually in levels d = 0) in the GECM model
- y.vrbl.d.y
the order of differencing of the y variable (of the lower level of differencing, usually in levels d = 0) in the GECM model
- x.d.vrbl
a named numeric vector of the x variables (of the higher level of differencing, usually first differences d = 1) and corresponding lag orders in the GECM model
- y.d.vrbl
a named numeric vector of the y variables (of the higher level of differencing, usually first differences d = 1) and corresponding lag orders in the GECM model. Can be
NULLif the model has no lags of the differenced dependent variables- x.d.vrbl.d.x
the order of differencing of the x variable (of the higher level of differencing, usually first differences d = 1) in the GECM model
- y.d.vrbl.d.y
the order of differencing of the y variable (of the higher level of differencing, usually first differences d = 1) in the GECM model
- shock.history
the desired shock history.
shock.historydetermines the shock history (h) that will be applied to the independent variable. -1 represents a pulse. 0 represents a step. These can also be specified viapulseandstep. For others, see Vande Kamp, Jordan, and Rajan. The default ispulse- inferences.y
does the user want resulting inferences about the dependent variable in
levelsor indifferences? The default islevels- inferences.x
does the user want to apply the shock history to the independent variable in
levelsor indifferences? The default islevels- effect.type
whether to return marginal effects or fitted values.
marginalreturns the GDRF as a marginal effect.fittedreturns the GDRF as a fitted value, relative to a baseline value of y. The default ismarginal- prediction.values
a named list of values for non-y variables in the model, used to calculate a steady-state baseline when
effect.type = "fitted"andd.y = 0andbaseline.yis not supplied. This allows for the calculation of model-based uncertainty. If any differenced variables are included in the model, they should be set to 0. Ignored whend.y > 0- baseline.y
a user-supplied baseline value of y in levels. For
d.y = 0, this overrides the steady-state calculation fromprediction.valuesif provided. Ford.y > 0withinferences.y = "levels", this is required (otherwise it is just marginal effects). Only used wheneffect.type = "fitted"- baseline.y.se
a user-supplied standard error for the baseline value of y (to suggest uncertainty around predictions). If supplied, this is added in quadrature to the standard errors of the GDRF estimates. Only used when
effect.type = "fitted"andinferences.y = "levels". The default is 0: in recognition that this is user-constructed uncertainty. Possible values would be the square root of the standard deviation of y (in levels)- shock.size
the size of the shock to x in the units of x. Only used when
effect.type = "fitted"; marginal effects are not scaled. Defaults to 1 (a marginal effect)- dM.level
a numeric significance level of the GDRF, calculated by the delta method. The default is 0.95
- s.limit
an integer for the number of periods to determine the GDRF (beginning at s = 0)
- se.type
a string for the type of standard error to extract from the model. The default is
const, but any argument tovcovHCfrom thesandwichpackage is accepted- return.data
logical to return the raw calculated GDRFs as a list element under
estimates. The default isFALSE- return.plot
logical to return the visualized GDRFs as a list element under
plot. The default isTRUE- return.formulae
logical to return the formulae for the GDRFs as a list element under
formulae(for the GDRFs) andbinomials(for the shock history). The default isFALSE- ...
other arguments to be passed to the call to plot
Value
depending on return.data, return.plot, and return.formulae, a list of elements relating to the GDRF
Details
We assume that the GECM model estimated is well specified, free of residual autocorrelation, balanced, and meets other standard time-series qualities. Given that, to obtain inferences for the specified shock history, the user only needs a named vector of the x and y variables, as well as the order of the differencing. Internally, the GECM to ADL equivalences are used to calculate the GDRFs from the GECM
Examples
# GECM(1,1)
# Use the toy data to run a GECM. No argument is made this
# is well specified or even sensible; it is just expository
model <- lm(d_y ~ l_1_y + l_1_x + l_1_d_y + d_x + l_1_d_x, data = toy.ts.interaction.data)
test.pulse <- GDRF.gecm.plot(model = model,
x.vrbl = c("l_1_x" = 1),
y.vrbl = c("l_1_y" = 1),
x.vrbl.d.x = 0,
y.vrbl.d.y = 0,
x.d.vrbl = c("d_x" = 0, "l_1_d_x" = 1),
y.d.vrbl = c("l_1_d_y" = 1),
x.d.vrbl.d.x = 1,
y.d.vrbl.d.y = 1,
shock.history = "pulse",
inferences.y = "levels",
inferences.x = "levels",
s.limit = 10,
return.plot = TRUE,
return.formulae = TRUE)
names(test.pulse)
#> [1] "plot" "formulae" "binomials"