orderedLasso: Fit an ordered lasso

Description Usage Arguments Value Examples

View source: R/funcs.R

Description

One of the main functions. Ordered Lasso builds a regression model with an L1-constraint imposed on the coefficients. The coefficients are re-written as negative and positive parts and the model requires positive and negative parts are monotone non-increasing and positive.

Usage

1
2
3
4
orderedLasso(x, y, lambda, intercept = TRUE, b0 = NULL, beta_pos = NULL,
  beta_neg = NULL, method = c("Solve.QP", "GG"), strongly.ordered = FALSE,
  standardize = TRUE, trace = FALSE, niter = 500, iter.gg = 100,
  epsilon = 1e-08)

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)

lambda

Regularization parameter(>0)

intercept

TRUE if there is an intercept in the model.

b0

Initial value for the intercept.

beta_pos

Optional vector of initialization of the positive part of the coefficients.

beta_neg

Optional vector of initialization of the negative part of the coefficients.

method

Two options available, Solve.QP and Generalized Gradient. Solve.QP uses the package quadprog to solve a quadratic programming problem. GG stands for genearlized gradient. GG uses proximal genearalized gradient algorithm to solve the problem. Detailed can be seen in the paper refered in the description.

strongly.ordered

An option which allows users to order the coefficients in absolute value. The coefficients returned by the orderedLasso may not be monotone non-increasing in absolute value even though the positive parts and negative parts are monotone non-increasing. Details can be seen in the paper referred in the Description. Strongly.ordered options returns the coefficients monotone non-increasing in absolute value.

standardize

Standardize the data matrix x

trace

Output option; trace = TRUE gives verbose output

niter

Maximum number of iterations; default 500.

iter.gg

Number of iterations of genearalized gradient; default 100

epsilon

Error tolerance parameter for convergence criterion ; default 1e-05.

Value

bp

Estimated coefficients- positive part

bn

Estimated coefficients- negative part

beta

Estimated coefficients, which are equal to bp - bn

b0

Estimated intercept, if there is one in the model.

fitted

Fitted values of y

type

Type of model fit, "gaussian"

call

The call to orderedLasso

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
set.seed(3)
n = 50
b = c(7,3,1,0)
p = length(b)
x = matrix(rnorm(n*p),nrow = n)
sigma = 4
y = x %*% b + sigma * rnorm(n, 0, 1)
result1 = orderedLasso(x,y, lambda = 1, intercept =TRUE, standardize = TRUE,
          method = "GG", strongly.ordered = TRUE)
result2 = orderedLasso(x,y, lambda = 1, intercept = TRUE, standardize =TRUE,
          strongly.ordered = TRUE)
print(result1)
print(result2)

Example output

Loading required package: Matrix
Call
orderedLasso(x = x, y = y, lambda = 1, intercept = TRUE, method = "GG", 
    strongly.ordered = TRUE, standardize = TRUE)

       beta_pos beta_neg       beta beta.ordered
[1,] 6.23014945        0 6.23014945   6.23014945
[2,] 3.16808611        0 3.16808611   3.16808611
[3,] 0.59988916        0 0.59988916   0.59988916
[4,] 0.05781525        0 0.05781525   0.05781525

beta_zero = 0.379694 beta.ordered_zero =  0.379694
Call
orderedLasso(x = x, y = y, lambda = 1, intercept = TRUE, strongly.ordered = TRUE, 
    standardize = TRUE)

       beta_pos     beta_neg       beta beta.ordered
[1,] 6.23001551 4.503967e-20 6.23001551   6.23001551
[2,] 3.16801566 0.000000e+00 3.16801566   3.16801566
[3,] 0.59987131 0.000000e+00 0.59987131   0.59987131
[4,] 0.05782413 0.000000e+00 0.05782413   0.05782413

beta_zero = 0.3796877 beta.ordered_zero =  0.3796877

orderedLasso documentation built on May 2, 2019, 6:36 a.m.