Learn R Programming

orderedLasso (version 1.7.1)

timeLagLasso.path: Fit a path of time-lasso models

Description

Fit a path of time-lasso models

Usage

timeLagLasso.path(x, y, lamlist = NULL, minlam = NULL, maxlam = NULL,
  nlam = 10, flmin = 0.01, strongly.ordered = TRUE, flmax = 1, maxlag,
  intercept = TRUE, standardize = TRUE, method = c("Solve.QP", "GG"),
  maxiter = 500, inneriter = 100, iter.gg = 100, trace = FALSE,
  epsilon = 1e-05)

Arguments

x

A matrix of predictors, where the rows are the samples and the columns are the predictors

y

A vector of observations, where length(y) equals nrow(x)

lamlist

Optional vector of values of lambda (the regularization parameter)

minlam

Optional minimum value for lambda

maxlam

Optional maximum value for lambda

nlam

Number of values of lambda to be tried

flmin

Fraction of maxlam minlam= flmin*maxlam. If computation is slow, try increasing flmin to focus on the sparser part of the path; default = 1e-2.

strongly.ordered

An option which allows users to order the coefficients in absolute value.

flmax

Multiplication of maxlam maxlam = flmax * maxlam. Default = 1

maxlag

Maximum time-lag chosen by user.

intercept

True if there is an intercept in the model.

standardize

Standardize the data matrix x.

method

Two options available, Solve.QP and Generalized Gradient

maxiter

Maximum iterations run by time-lag lasso. Initiazlied to 500.

inneriter

maximum iterations run by orderedLasso. Initialized to 100.

iter.gg

Maximum iterations run by generalized gradient. Intialized to 100

trace

Output option; trace = TRUE gives verbose output.

epsilon

Error tolerance parameter for convergence criterion; default 1e-5

Value

bp

p by nlam matrix of estimated positive coefficients(p=#variables)

bn

p by nlam matrix of estimated negative coefficients

beta

p by nlam matrix of estimated coefficients

b0

a vector of length nlam of estimated intercept

lamlist

Vector of values of lambda used

err

Vector of errors

maxlag

Maximum time-lag variable

p

The number of predictors

fited

a length(y) by nlam matrix of fitted values

call

The call to "timeLagLasso.path"

Examples

Run this code
# NOT RUN {
set.seed(3)
n = 50
maxlag = 5
num_rows_needed = n + maxlag + 1
sigma = 4
x = matrix(rnorm(num_rows_needed * 4), nrow = num_rows_needed)
x_new = time_lag_matrix(x, maxlag)
b = c(3,1,1,0,0,
      4,1,0,0,0,
      3,2,1,0,0,
      1,0,0,0,0)
y = x_new %*% b + sigma* rnorm(nrow(x_new))
y = as.vector(y)
y = c(y, rnorm(maxlag + 1))
path1 = timeLagLasso.path(x= x, y = y, maxlag = 5, method = "Solve.QP", strongly.ordered = TRUE)
plot(path1)
# }

Run the code above in your browser using DataLab