specs_tr {specs}R Documentation

SPECS on pre-transformed data

Description

This function computes the Single-equation Penalized Error Correction Selector as described in Smeekes and Wijler (2020) based on data that is already in the form of a conditional error-correction model.

Usage

specs_tr(
  y_d,
  z_l = NULL,
  w,
  deterministics = c("constant", "trend", "both", "none"),
  ADL = FALSE,
  weights = c("ridge", "ols", "none"),
  k_delta = 1,
  k_pi = 1,
  lambda_g = NULL,
  lambda_i = NULL,
  thresh = 1e-04,
  max_iter_delta = 1e+05,
  max_iter_pi = 1e+05,
  max_iter_gamma = 1e+05
)

Arguments

y_d

A vector containing the differences of the dependent variable.

z_l

A matrix containing the lagged levels.

w

A matrix containing the required difference

deterministics

Indicates which deterministic variables should be added (0 = none, 1=constant, 2=constant and linear trend).

ADL

Boolean 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.

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. Defaults is 1e5.

max_iter_pi

Maximum number of updates for pi. Defaults is 1e5.

max_iter_gamma

Maximum number of updates for gamma. Defaults is 1e5.

Value

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.

gamma_opt

A vector containing the estimated coefficients corresponding to the optimal model.

lambda_g

The grid of group penalties.

lambda_i

The grid of individual penalties.

theta

The estimated coefficients for the constant and trend. If a deterministic component is excluded, its coefficient is set to zero.

theta_opt

The estimated coefficients for the constant and trend in the optimal model.

weights

The vector of penalty weights.

Examples


#Estimate a conditional error-correction model on pre-transformed data with a constant

#Organize data
y <- Unempl_GT[,1]
index_GT <- sample(c(2:ncol(Unempl_GT)),10)
x <- Unempl_GT[,index_GT]
y_d <- y[-1]-y[-100]
z_l <- cbind(y[-100],x[-100,])
w <- x[-1,]-x[-100,] #This w corresponds to a cecm with p=0 lagged differences

my_specs <- specs_tr(y_d,z_l,w,deterministics="constant")

#Estimate an ADL model on pre-transformed data with a constant

my_specs <- specs_tr(y_d,NULL,w,ADL=TRUE,deterministics="constant")

[Package specs version 1.0.1 Index]