dsda: Solution path for direct sparse discriminant analysis

Description Usage Arguments Value Author(s) References Examples

View source: R/dsda.R

Description

Compute the solution path for direct sparse discriminant analysis (DSDA).

Usage

1
2
dsda(x, z=NULL, y, testx=NULL, testz=NULL, standardize=FALSE, 
 lambda=lambda, alpha=1, eps=1e-7)

Arguments

x

Input matrix of predictors. x is of dimension N*p; each row is an observation vector.

z

Input covariate matrix of dimension N*q, where q<N. z can be omitted if covariate is absent.

y

An n-dimensional vector containing the class labels. The classes have to be labeled as 1 and 2.

testx

Input testing matrix. Each row is a test case. When testx is not provided, the function will only fit the model and return the classifier. When testx is provided, the function will predict response on testx as well.

testz

Input testing covariate matrix. Can be omitted if covariate is absent. However, training covariates z and testing covariates testz must be provided or not at the same time.

standardize

A logic object indicating whether x should be standardized before performing DSDA. Default is FALSE.

lambda

A sequence of lambda's. If lambda is missed, the function will automatically generates a sequence of lambda's to fit model.

alpha

The elasticnet mixing parameter, the same as in glmnet. Default is alpha=1 so that the lasso penalty is used.

eps

Convergence threshold for coordinate descent, the same as in glmnet. Default is 1e-7.

Value

beta

Output variable coefficients for each lambda. The first element of each solution is the intercept.

lambda

The sequence of lambda's used in computing the solution path.

x

The predictor matrix in training data.

y

The class label in training data.

pred

Predicted categorical response for each value in sequence lambda when testx is provided.

Author(s)

Yuqing Pan, Qing Mai, Xin Zhang

References

Mai, Q., Zou, H. and Yuan, M. (2013). A direct approach to sparse discriminant analysis in ultra-high dimensions. Biometrika, 99, 29-42.

Examples

1
2
3
4
5
6
  data(GDS1615)   ##load the prostate data
  x<-GDS1615$x
  y<-GDS1615$y
  x=x[which(y<3),]
  y=y[which(y<3)]
  obj.path <- dsda(x, y=y)

TULIP documentation built on Jan. 13, 2021, 3:14 p.m.

Related to dsda in TULIP...