SGL: main function of SGL

Description Usage Arguments Value Author(s) References Examples

Description

main function of SGL

Usage

1
SGL(data, index, type = "linear", maxit = 1000, thresh = 0.001, min.frac = 0.1, nlam = 20, gamma = 0.8, standardize = TRUE, verbose = FALSE, step = 1, reset = 10, alpha = 0.95, lambdas = NULL)

Arguments

data

input data, x and y

index

index

maxit

maxit

thresh

threshold

min.frac

minfrac

nlam

number of lambdas

gamma

gamma

standardize

flag of standardization

verbose

verbose

step

step

reset

reset

alpha

alpha

lambdas

sequence of lambdas

Value

result of SGL

Author(s)

Noah Simon, Jerome Friedman, Trevor Hastie, and Rob Tibshirani

References

Simon, N., Friedman, J., Hastie T., and Tibshirani, R. (2011) A Sparse-Group Lasso, http://www-stat.stanford.edu/~nsimon/SGL.pdf

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
27
28
29
30
31
32
33
34
35
36
37
38
##---- Should be DIRECTLY executable !! ----
##-- ==>  Define data, use random,
##--	or do  help(data=index)  for the standard data sets.

## The function is currently defined as
function (data, index, maxit = 1000, thresh = 0.001, min.frac = 0.1, 
    nlam = 20, gamma = 0.8, standardize = TRUE, verbose = FALSE, 
    step = 1, reset = 10, alpha = 0.95, lambdas = NULL) 
{
    X.transform <- NULL
    if (standardize == TRUE) {
        X <- data$x
        means <- apply(X, 2, mean)
        X <- t(t(X) - means)
        var <- apply(X, 2, function(x) (sqrt(sum(x^2))))
        X <- t(t(X)/var)
        data$x <- X
        X.transform <- list(X.scale = var, X.means = means)
    }
    if (standardize == TRUE) {
        intercept <- mean(data$y)
        data$y <- data$y - intercept
    }
    Sol <- oneDim(data, index, thresh, inner.iter = maxit, outer.iter = maxit, 
        outer.thresh = thresh, min.frac = min.frac, nlam = nlam, 
        lambdas = lambdas, gamma = gamma, verbose = verbose, 
        step = step, reset = reset, alpha = alpha)
    if (standardize == TRUE) {
        Sol <- list(beta = Sol$beta, lambdas = Sol$lambdas, type = type, 
            intercept = intercept, X.transform = X.transform)
    }
    if (standardize == FALSE) {
        Sol <- list(beta = Sol$beta, lambdas = Sol$lambdas, type = type, 
            X.transform = X.transform)
    }
    class(Sol) = "SGL"
    return(Sol)
  }

boris109able/ChangePointCalc documentation built on May 13, 2019, 12:34 a.m.