Last chance! 50% off unlimited learning
Sale ends in
dlsem(model.code, group = NULL, exogenous = NULL, data, log = FALSE, control = NULL, imputation = TRUE, uniroot.check = TRUE, test = "adf", combine = "choi", k = 0, lshort = TRUE, maxdiff = 5, tol = 0.0001, maxit = 500, selection = "aic", plotDir = NULL)
formula
, each describing a single regression model. See Details
.NULL
, no groups are considered.data.frame
containing data.TRUE
, logarithmic transformation is applied to quantitative variables. Default is FALSE
.Details
.TRUE
, missing values will be imputed using the EM algorithm. Default is FALSE
.TRUE
, unit root test is performed for each variable, and appropriate differentation is applied. Default is FALSE
."adf"
or "kpss"
(see unirootTest). Ignored if uniroot.check
=FALSE
. Default is "adf"
."choi"
or "demetrescu"
(see unirootTest).
Ignored if uniroot.check
=FALSE
or group
is NULL
. Default is "choi"
.uniroot.check
=FALSE
or if test
="kpss"
. Default is 0.TRUE
, the short version of the truncation lag parameter is used for the KPSS test.
Ignored if uniroot.check
=FALSE
or if test
="adf"
. Default is TRUE
.uniroot.check
=FALSE
. Default is 5.imputation
=FALSE
. Default is 500.imputation
=FALSE
. Default is 0.0001."aic"
to minimise the Akaike Information Criterion,
"bic"
to minimise the Bayesian Information Criterion (AIC), and "mdl"
to minimise the Minimum Description Length. Default is "aic"
.NULL
, no plots will be produced.dlsem
, with the following components:S3 methods available for class dlsem
are:quec
: quadratic (2nd order polynomial) lag shape with endpoint constraints;
qdec
: quadratic (2nd order polynomial) decreasing lag shape.
gamma
: gamma lag shape.
Each operator must have the following three arguments (provided within brackets):
delta
parameter (for the gamma lag shape)
lambda
parameter (for the gamma lag shape).
For example, quec(X1,3,15)
indicates that a quadratic lag shape with endpoint constraints must be applied to variable X1 in the interval (3,15),
and gamma(X1,0.75,0.8)
indicates that a gamma lag shape with delta
=0.75 and lambda
=0.8 must be applied to variable X1.
The formula of regression models with no covariates excepting exogenous variables can be omitted from argument model.code
.
Variables appearing in any formula are treated as quantitative.
The group factor and exogenous variables must not appear in any formula.
Argument control
must be a named list containing one or more among the following components:
L
: a named vector of non-negative integer values including the highest lag with non-zero autocorrelation for one or more response variables.
If greater than 0, the Newey-West correction of the covariance matrix of estimates (Newey and West, 1987) is used. Default is 0 for all response variables.
adapt
: a named vector of logical values indicating if adaptation of lag shapes must be performed for one or more response variables. Default is FALSE
for all response variables.
max.gestation
: a named list. Each component of the list must refer to one response variable and contain a named vector, including the maximum gestation lag for one or more covariates.
If not provided, it is taken as equal to max.width
(see below). Ignored if adapt
=FALSE
for a certain covariate.
min.width
: a named list. Each component of the list must refer to one response variable and contain a named vector, including the minimum lag width for one or more covariates.
If not provided, it is taken as 0. Ignored if adapt
=FALSE
for a certain covariate.
max.width
: a named list. Each component of the list must refer to one response variable and contain a named vector, including the maximum lag width for one or more covariates.
If not provided, it is computed accordingly to the sample size. Ignored if adapt
=FALSE
for a certain covariate.
sign
: a named list. Each component of the list must refer to one response variable and contain a named vector, including the sign
(either '+' for non-negative, or '-' for non-positive) of the coefficients of one or more covariates.
If not provided, adaptation will disregard the sign of coefficients. Ignored if adapt
=FALSE
for a certain covariate.
Variables appearing in the model code but not included in data will be considered as unobserved.
If there is at least one unobserved variable, imputation using EM will be performed whatever the value of argument imputation
.
W. K. Newey, and K. D. West (1978). A Simple, Positive Semi-Definite, Heteroskedasticity and Autocorrelation Consistent Covariance Matrix. Econometrica, 55(3), 703-708.
data(industry)
# estimation without control options
mycode <- list(
Consum~quec(Job,0,6),
Pollution~quec(Job,1,11)+quec(Consum,1,6)
)
myfit <- dlsem(mycode,group="Region",exogenous=c("Population","GDP"),
data=industry,uniroot.check=TRUE,log=TRUE)
### adaptation of lag shapes (may take some seconds more)
## model code
#mycode <- list(
# Consum~quec(Job,0,15),
# Pollution~quec(Job,0,15)+quec(Consum,0,15)
# )
#
#mycontrol <- list(
# adapt=c(Consum=T,Pollution=T),
# max.gestation=list(Consum=c(Job=3),Pollution=c(Consum=3,Job=3)),
# min.width=list(Consum=c(Job=5),Pollution=c(Consum=5,Job=5)),
# max.width=list(Consum=c(Job=15),Pollution=c(Consum=15,Job=15)),
# sign=list(Consum=c(Job="+"),Pollution=c(Consum="+",Job="+"))
# )
#myfit <- dlsem(mycode,group="Region",exogenous=c("Population","GDP"),data=industry,
# control=mycontrol,uniroot.check=TRUE,log=TRUE)
# summaries of estimation
summary(myfit)
# display the directed acyclic graph
plot(myfit)
Run the code above in your browser using DataLab