Description Usage Arguments Details Value Examples
This function estimates the Single-equation Penalized Error Correction Selector as described in Smeekes and Wijler (2020). The function takes a dependent variable y and a matrix of independent variables x as input, and transforms it to a conditional error correction model. This model is estimated by means of penalized regression, involving L1-penalty on individual coefficients and a potential L2-penalty on the coefficients of the lagged levels in the model, see Smeekes and Wijler (2020) for details.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
y |
A vector containing the dependent variable in levels. |
x |
A matrix containing the independent variables in levels. |
p |
Integer indicating the desired number of lagged differences to include. Default is 1. |
deterministics |
A character object indicating which deterministic variables should be added ("none","constant","trend","both"). Default is "constant". |
ADL |
Logical object indicating whether an ADL model without error-correction term should be estimated. Default is FALSE. |
weights |
Choice of penalty weights. The weights can be automatically generated by ridge regression (default) or ols. Alternatively, a conformable vector of non-negative weights can be supplied or no weights can be applied. |
k_delta |
The power to which the weights for delta should be raised, if weights are set to "ridge" or "ols". |
k_pi |
The power to which the weights for pi should be raised, if weights are set to "ridge" or "ols". |
lambda_g |
An optional user-specified grid for the group penalty may be supplied. If left empty, a 10-dimensional grid containing 0 as the minimum value is generated. |
lambda_i |
An optional user-specified grid for the individual penalty may be supplied. If left empty, a 10-dimensional grid containing 0 as the minimum value is generated. |
thresh |
The treshold for convergence. |
max_iter_delta |
Maximum number of updates for delta. Default is 10^5. |
max_iter_pi |
Maximum number of updates for pi. Default is 10^5. |
max_iter_gamma |
Maximum number of updates for gamma. Default is 10^5. |
The function can generate an automated sequence of penalty parameters and offers the option to compute and include adaptive penalty weights. In addition, it is possible to estimate a penalized ADL model in differences by excluding the lagged levels from the model. For automated selection of an optimal penalty value, see the function specs_opt(...).
D |
A matrix containing the deterministic variables included in the model. |
gammas |
A matrix containing the estimated coefficients of the stochastic variables in the conditional error-correction model. |
lambda_g |
The grid of group penalties. |
lambda_i |
The grid of individual penalties. |
Mv |
A matrix containing the independent variables, after regressing out the deterministic components. |
My_d |
A vector containing the dependent variable, after regressing out the deterministic components. |
theta |
The estimated coefficients for the constant and trend. If a deterministic component is excluded, its coefficient is set to zero. |
v |
A matrix containing the independent variables (excluding deterministic components). |
weights |
The vector of penalty weights. |
y_d |
A vector containing the dependent variable, i.e. the differences of y. |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | #Estimate a model for unemployment and ten google trends
#Organize data
y <- Unempl_GT[,1]
index_GT <- sample(c(2:ncol(Unempl_GT)),10)
x <- Unempl_GT[,index_GT]
#Estimate a CECM with 1 lagged differences
my_specs <- specs(y,x,p=1)
#Estimate a CECM with 1 lagged differences and no group penalty
my_specs2 <- specs(y,x,p=1,lambda_g=0)
#Estimate an autoregressive distributed lag model with 2 lagged differences
my_specs3 <- specs(y,x,ADL=TRUE,p=2)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.