cvFSGL: Fit and Cross-Validate a Linear Model with a Combination of...

Description Usage Arguments Value Examples

View source: R/cvFSGL.R

Description

Fit and Cross-Validate a Linear Model with a Combination of Lasso and Group Lasso Regularization

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
cvFSGL(
  data,
  index,
  nfold = 10,
  nlam = 20,
  min.frac = 0.05,
  alpha = 0.95,
  lambdas = NULL,
  thresh = 1e-04,
  maxit = 10000,
  gamma = 0.8,
  verbose = TRUE,
  step = 1,
  reset = 10,
  foldid = NA,
  UseUpperBound = FALSE
)

Arguments

data

data should be a list of $x$ and $y$, x is a data matrix (n x p) and y is a vector

index

A p-vector indicating group membership of each covariate

nfold

Number of folds of the cross-validation loop

nlam

Number of lambda to use in the regularization path

min.frac

The minimum value of the penalty parameter, as a fraction of the maximum value

alpha

The mixing parameter. alpha = 1 is the lasso penalty.

lambdas

A user inputted sequence of lambda values for fitting. We recommend leaving this NULL and letting FSGL self-select values

thresh

Convergence threshold for change in beta

maxit

Maximum number of iterations to convergence

gamma

Fitting parameter used for tuning backtracking (between 0 and 1)

verbose

Logical flag for whether or not step number will be output

step

Fitting parameter used for inital backtracking step size (between 0 and 1)

reset

Fitting parameter used for taking advantage of local strong convexity in nesterov momentum (number of iterations before momentum term is reset)

foldid

An optional user-pecified vector indicating the cross-validation fold in which each observation should be included. Values in this vector should range from 1 to nfold. If left unspecified, SGL will randomly assign observations to folds

UseUpperBound

A logical flag for using upper bound

Value

An object with S3 class "cv.FSGL"

lldiff

An nlam vector of cross validated negative log likelihoods (squared error loss in the linear case, along the regularization path)

llSD

An nlame vector of approximate standard deviations of lldiff

lambdas

The actual list of lambda values used in the regularization path.

fit

A model fit object created by a call to FSGL on the entire dataset

foldid

A vector indicating the cross-validation folds that each observation is assigned to

prevals

A matrix of prevalidated predictions for each observation, for each lambda-value

Examples

1
2
3
4
5
6
7
8
set.seed(1)
n = 50; p = 100; size.groups = 10
index <- ceiling(1:p / size.groups)
X = matrix(rnorm(n * p), ncol = p, nrow = n)
beta = (-2:2)
y = X[,1:5] %*% beta + 0.1*rnorm(n)
data = list(x = X, y = y)
cvFit = cvFSGL(data, index)

xhnnnnn/FSGL documentation built on Jan. 7, 2022, 6:51 p.m.