rlassoHAC: 'rlassoHAC' performs Lasso estimation under heteroscedastic...

Description Usage Arguments Value Source Examples

View source: R/HACLasso.r

Description

rlassoHAC performs Lasso estimation under heteroscedastic and autocorrelated non-Gaussian disturbances.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
rlassoHAC(
  x,
  y,
  kernel = "Bartlett",
  bands = 10,
  bns = 10,
  lns = NULL,
  nboot = 5000,
  post = TRUE,
  intercept = TRUE,
  model = TRUE,
  X.dependent.lambda = FALSE,
  c = 2,
  gamma = NULL,
  numIter = 15,
  tol = 10^-5,
  threshold = NULL,
  ...
)

Arguments

x

Regressors (vector, matrix or object can be coerced to matrix).

y

Dependent variable (vector, matrix or object can be coerced to matrix).

kernel

Kernel function, choose between "Truncated", "Bartlett" (by default), "Parzen", "Tukey-Hanning", "Quadratic Spectral".

bands

Bandwidth parameter with default bands=10.

bns

Block length with default bns=10.

lns

Number of blocks with default lns = floor(T/bns).

nboot

Number of bootstrap iterations with default nboot=5000.

post

Logical. If TRUE (default), post-Lasso estimation is conducted, i.e. a refit of the model with the selected variables.

intercept

Logical. If TRUE, intercept is included which is not penalized.

model

Logical. If TRUE (default), model matrix is returned.

X.dependent.lambda

Logical, TRUE, if the penalization parameter depends on the design of the matrix x. FALSE (default), if independent of the design matrix.

c

Constant for the penalty, default value is 2.

gamma

Constant for the penalty, default gamma=0.1/log(T) with T=data length.

numIter

Number of iterations for the algorithm for the estimation of the variance and data-driven penalty, ie. loadings.

tol

Constant tolerance for improvement of the estimated variances.

threshold

Constant applied to the final estimated lasso coefficients. Absolute values below the threshold are set to zero.

...

further parameters

Value

rlassoHAC returns an object of class "rlasso". An object of class "rlasso" is a list containing at least the following components:

coefficients

Parameter estimates.

beta

Parameter estimates (named vector of coefficients without intercept).

intercept

Value of the intercept.

index

Index of selected variables (logical vector).

lambda

Data-driven penalty term for each variable, product of lambda0 (the penalization parameter) and the loadings.

lambda0

Penalty term.

loadings

Penalty loadings, vector of lenght p (no. of regressors).

residuals

Residuals, response minus fitted values.

sigma

Root of the variance of the residuals.

iter

Number of iterations.

call

Function call.

options

Options.

model

Model matrix (if model = TRUE in function call).

Source

Victor Chernozhukov, Chris Hansen, Martin Spindler (2016). hdm: High-Dimensional Metrics, R Journal, 8(2), 185-199. URL https://journal.r-project.org/archive/2016/RJ-2016-040/index.html.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
 

set.seed(1)
T = 100 #sample size
p = 20 # number of variables
b = 5 # number of variables with non-zero coefficients
beta0 = c(rep(10,b), rep(0,p-b))
rho = 0.1 #AR parameter
Cov = matrix(0,p,p)
for(i in 1:p){
  for(j in 1:p){
     Cov[i,j] = 0.5^(abs(i-j))
  }
} 
C <- chol(Cov)
X <- matrix(rnorm(T*p),T,p)%*%C
eps <- arima.sim(list(ar=rho), n = T+100)
eps <- eps[101:(T+100)] 
Y = X%*%beta0 + eps
reg.lasso.hac1 <- rlassoHAC(X, Y,"Bartlett") #lambda is chosen independent of regressor 
                                             #matrix X by default.

bn = 10 # block length
bwNeweyWest = 0.75*(T^(1/3))
reg.lasso.hac2 <- rlassoHAC(X, Y,"Bartlett", bands=bwNeweyWest, bns=bn, nboot=5000,
                            X.dependent.lambda = TRUE, c=2.7) 

tsapp documentation built on Oct. 30, 2021, 5:08 p.m.

Related to rlassoHAC in tsapp...