orderedLasso.path: Fit a path of ordered lasso models

Description Usage Arguments Value Examples

View source: R/funcs.R

Description

Fit a path of ordered lasso models over different values of the regularization parameter.

Usage

1
2
3
4
orderedLasso.path(x, y, lamlist = NULL, minlam = NULL, maxlam = NULL,
  nlam = 50, flmin = 0.005, intercept = TRUE, standardize = TRUE,
  method = c("Solve.QP", "GG"), niter = 500, iter.gg = 100,
  strongly.ordered = FALSE, 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. Default nlam = 50

flmin

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

intercept

True if there is an intercept in the model.

standardize

Standardize the data matrix x. Default is TRUE.

method

Two options available, Solve.QP and Generalized Gradient.

niter

Number of iterations of ordered lasso, initialized to 500.

iter.gg

Number of iterations of genearalized gradient; Default iter.gg = 100

strongly.ordered

An option which allows users to order the coefficients non-decreasing in absolute value. Details can be seen in the orderedLasso Description.

trace

Output option; trace=TRUE gives verbose output

epsilon

Error tolerance parameter for convergence criterion. Default is 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 length nlam vector of estimated intercepts

lamlist

Vector of values of lambda used

err

Vector of errors

call

The call to orderedLasso.path

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
set.seed(3)
n = 50
b = c(4,3,1,0)
p = length(b)
x = matrix(rnorm(n*p),nrow = n)
sigma = 5
y = x %*% b + sigma * rnorm(n, 0, 1)
path1 = orderedLasso.path(x,y, intercept =  FALSE, 
        method = "Solve.QP", strongly.ordered = TRUE)
plot(path1)
print(path1)

Example output

Loading required package: Matrix
Call
orderedLasso.path(x = x, y = y, intercept = FALSE, method = "Solve.QP", 
    strongly.ordered = TRUE)

           Lambda    Error Error.ordered
 [1,] 111.0863760 37.85525      37.85525
 [2,]  99.7013418 35.47722      35.47722
 [3,]  89.4831384 33.60716      33.60716
 [4,]  80.3121794 32.14162      32.14162
 [5,]  72.0811349 30.99775      30.99775
 [6,]  64.6936746 30.10923      30.10923
 [7,]  58.0633413 29.42303      29.42303
 [8,]  52.1125384 28.89679      28.89679
 [9,]  46.7716221 28.49667      28.49667
[10,]  41.9780863 28.19571      28.19571
[11,]  37.6758310 27.97245      27.97245
[12,]  33.8145058 27.80980      27.80980
[13,]  30.3489206 27.69421      27.69421
[14,]  27.2385167 27.61496      27.61496
[15,]  24.4468922 27.56356      27.56356
[16,]  21.9413761 27.51367      27.51367
[17,]  19.6926456 27.46180      27.46180
[18,]  17.6743833 27.42916      27.42916
[19,]  15.8629689 27.41105      27.41105
[20,]  14.2372030 27.40383      27.40383
[21,]  12.7780588 27.40461      27.40461
[22,]  11.4684595 27.41116      27.41116
[23,]  10.2930786 27.42082      27.42082
[24,]   9.2381603 27.42782      27.42782
[25,]   8.2913586 27.43754      27.43754
[26,]   7.4415928 27.44903      27.44903
[27,]   6.6789179 27.46157      27.46157
[28,]   5.9944082 27.47462      27.47462
[29,]   5.3800525 27.48778      27.48778
[30,]   4.8286610 27.50076      27.50076
[31,]   4.3337806 27.51335      27.51335
[32,]   3.8896196 27.52540      27.52540
[33,]   3.4909798 27.53683      27.53683
[34,]   3.1331958 27.54757      27.54757
[35,]   2.8120804 27.55761      27.55761
[36,]   2.5238756 27.56694      27.56694
[37,]   2.2652083 27.57557      27.57557
[38,]   2.0330514 27.58353      27.58353
[39,]   1.8246878 27.59083      27.59083
[40,]   1.6376789 27.59752      27.59752
[41,]   1.4698363 27.60363      27.60363
[42,]   1.3191955 27.60920      27.60920
[43,]   1.1839937 27.61427      27.61427
[44,]   1.0626484 27.61888      27.61888
[45,]   0.9537395 27.62306      27.62306
[46,]   0.8559926 27.62685      27.62685
[47,]   0.7682635 27.63028      27.63028
[48,]   0.6895256 27.63338      27.63338
[49,]   0.6188574 27.63683      27.63619
[50,]   0.5554319 27.64077      27.63872

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