PSM_solver {PRIMAL}R Documentation

Solve given problem in parametric simplex method

Description

Solve given problem in parametric simplex method

Usage

PSM_solver(A, b, b_bar, c, c_bar, B_init = NULL, max_it = 50,
  lambda_threshold = 0.01)

Arguments

A

A is an n by d data matrix

b

b is a length n response vector

b_bar

b_bar is a length n vector time to parameter in constraints.

c

c is a length d vector in target function.

c_bar

c_bar is a length d vector time to parameter in target function

B_init

B_init is the index of initial basic colume.

max_it

This is the number of the maximum path length one would like to achieve. The default length is 50.

lambda_threshold

The parametric simplex method will stop when the calculated parameter is smaller than lambda. The default value is 0.01.

Value

An object with S3 class "primal" is returned:

data

The n by d data matrix from the input

response

The length n response vector from the input

beta

A matrix of regression estimates whose columns correspond to regularization parameters for parametric simplex method.

beta0

A vector of regression estimates whose index correspond to regularization parameters for parametric simplex method.

df

The degree of freecom (number of nonzero coefficients) along the solution path.

value

The sequence of optimal value of the object function corresponded to the sequence of lambda.

iterN

The number of iteration in the program.

lambda

The sequence of regularization parameters lambda obtained in the program.

type

The type of the problem, such as Dantzig and SparseSVM.

See Also

primal-package

Examples

## This example show how to use PSM_solver() to solve dantzig problem.
## Generate the design matrix and coefficient vector
n = 100 # sample number
d = 250 # sample dimension
c = 0.5 # correlation parameter
s = 20  # support size of coefficient
set.seed(1024)
X = scale(matrix(rnorm(n*d),n,d)+c*rnorm(n))/sqrt(n-1)*sqrt(n)
beta = c(rnorm(s), rep(0, d-s))
## Generate response using Gaussian noise, and solve the solution path
noise = rnorm(n)
Y = X%*%beta + noise
## Define parameters for dantzig problem
XtX = t(X)%*%X
A = cbind(cbind(rbind(XtX,-XtX),-rbind(XtX,-XtX)),diag(rep(1,2*d)))
b = rbind(t(X)%*%Y,-t(X)%*%Y)
c = c(rep(-1,2*d),rep(0,2*d))
c_bar = rep(0,4*d)
b_bar = rep(1,2*d)
B_init = seq(2*d,4*d-1)
## Dantzig selection solved with parametric simplex method
fit.dantzig = PSM_solver(A, b, b_bar, c, c_bar, B_init, max_it = 50, lambda_threshold = 0.01)
###lambdas used
print(fit.dantzig$lambda)
## number of nonzero coefficients for each lambda
print(fit.dantzig$df)
## Visualize the solution path
plot(fit.dantzig)

[Package PRIMAL version 1.0.2 Index]