dlm {dLagM} | R Documentation |
Implement finite distributed lag model
Description
Applies distributed lag models with one or multiple predictor(s).
Usage
dlm(formula , data , x , y , q , remove , type)
Arguments
formula |
A |
data |
A |
x |
A vector including the observations of predictor time series. This is not restricted to |
y |
A vector including the observations of dependent time series. This is not restricted to |
q |
An integer representing finite lag length. |
remove |
A list object showing the lags to be removed from the model for each independent series in its elements. Please see the details for the construction of this argument. |
type |
An integer taking 1 if only x and y vectors are entered, 2 if a formula and data matrix is entered. It can be left |
Details
When a decision made on a variable, some of the related variables would be effected through time. For example, when income tax rate is increased, this would reduce expenditures of consumers on goods and services, which reduces profits of suppliers, which reduces the demand for productive inputs, which reduces the profits of the input suppliers, and so on (Judge and Griffiths, 2000). These effects occur over the future time periods; hence, they are distributed across the time.
In a distributed-lag model, the effect of an independent variable X
on a dependent variable Y
occurs over the time. Therefore, DLMs are dynamic models. A linear finite DLM with one independent variable is written as follows:
Y_{t} = \alpha +\sum_{s = 0}^{q}\beta_{s}X_{t-s}+\epsilon_{t},
where \epsilon_{t}
is a stationary error term with E(\epsilon_{t})=0, Var(\epsilon_{t})=\sigma^{2},Cov(\epsilon_{t},\epsilon_{s})=0
.
When there is only one predictor series, both of model
and formula
objects can be used. But when they are supplied, both x
and y
arguments should be NULL
.
The variable names in formula
must match with the names of variables in data
argument and it must be in the form of a generic formula for R functions.
The argument data
contains dependent series and independent series. Required lags of dependent series are generated by the dlm
function automatically.
The argument remove = list()
is used to specify which lags will be removed from the full model. Each element of the list remove
shows particular lags that will be removed from each independent series. Notice that it is possible to fit a model with different lag lengths for each independent series by removing the appropriate lags of independent series with remove
argument. To remove the main series from the model include 0
within the elements of remove
.
To remove the intercept from the model, if a formula
is entered, just include "-1" in the model formula. Otherwise, include "-1" in the element remove
of the list remove
. See the examples below for implementation details.
The standard function summary()
prints model summary for the model of interest.
Value
model |
An object of class |
designMatrix |
The design matrix composed of transformed z-variables. |
k |
The number of independent series. This is returned if multiple independent series are entered. |
q |
The lag length. |
removed |
A list or vector showing the removed lags from the model for independent series. Returns |
formula |
Model formula of the fitted model. This is returned if multiple independent series are entered. |
data |
A |
Author(s)
Haydar Demirhan
Maintainer: Haydar Demirhan <haydar.demirhan@rmit.edu.au>
References
B.H. Baltagi. Econometrics, Fifth Ed. Springer, 2011.
R.C. Hill, W.E. Griffiths, G.G. Judge. Undergraduate Econometrics. Wiley, 2000.
Examples
# Only one independent series
data(seaLevelTempSOI)
model.dlm = dlm(x = seaLevelTempSOI$LandOcean,
y = seaLevelTempSOI$GMSL , q = 5)
summary(model.dlm)
residuals(model.dlm)
coef(model.dlm)
fitted(model.dlm)
removed = list(x = c(1))
model.dlm = dlm(x = seaLevelTempSOI$LandOcean,
y = seaLevelTempSOI$GMSL , q = 5,
remove = removed)
summary(model.dlm)
# Remove intercept as well
removed = list(x = c(1,-1))
model.dlm = dlm(x = seaLevelTempSOI$LandOcean,
y = seaLevelTempSOI$GMSL , q = 5,
remove = removed)
summary(model.dlm)
removed = list(x = c(0,1))
model.dlm = dlm(x = seaLevelTempSOI$LandOcean,
y = seaLevelTempSOI$GMSL , q = 5,
remove = removed)
summary(model.dlm)
model.dlm = dlm(formula = GMSL ~ LandOcean ,
data = seaLevelTempSOI , q = 5)
summary(model.dlm)
removed = list(x = c(0,1))
model.dlm = dlm(formula = GMSL ~ LandOcean ,
data = seaLevelTempSOI , q = 5,
remove = removed)
summary(model.dlm)
# Remove intercept as well
removed = list(x = c(0,-1))
model.dlm = dlm(formula = GMSL ~ LandOcean ,
data = seaLevelTempSOI , q = 2,
remove = removed)
summary(model.dlm)
# Multiple independent series
data(M1Germany)
data = M1Germany[1:144,]
model.dlm = dlm(formula = logprice ~ interest + logm1,
data = data.frame(data) , q = 4)
summary(model.dlm)
removed = list(interest = c(1,3), logm1 = c(2))
removed
model.dlm = dlm(formula = logprice ~ interest + logm1,
data = data.frame(data) , q = 4 , remove = removed)
summary(model.dlm)
removed = list(interest = c(0,1,3), logm1 = c(0,2))
removed
model.dlm = dlm(formula = logprice ~ interest + logm1,
data = data.frame(data) , q = 4 , remove = removed)
summary(model.dlm)
removed = list( logm1 = c(1,2))
removed
model.dlm = dlm(formula = logprice ~ interest + logm1,
data = data.frame(data) , q = 4 , remove = removed)
summary(model.dlm)