objFun: Objective function

Description Usage Arguments Value Examples

View source: R/add.r

Description

Objective (non-convex) function to minimize (objFun=-logL+ lamda*CL, CL= (1-w)L0 + wL1)

Usage

1
objFun(x, y, lamda, w, beta, epsilon)

Arguments

x

input matrix, of dimension nobs x nvars. Each row is an observation vector.

y

binary response variable

lamda

a tuning penalty parameter

w

the weighting parameter for L1; then (1-w) is the weight for L0

beta

coefficients

epsilon

the continuity parameter

Value

the value of the objective function evaluated at the given points.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
set.seed(14)
beta    <- c(3, 2, -1.6, -1)
noise   <- 5
simData <- SimData(N=100, beta=beta, noise=noise, corr=FALSE)

x  <- as.matrix(simData[,-1][,1])
y  <- as.matrix(simData$y)
betapoints <- seq(-2,2,0.01)

lamda <- 1
w     <- 0.6
epsilon <- 0.1

out <- numeric(length(betapoints))
for(i in 1:length(betapoints)){
 out[i]<- objFun(x, y, lamda=lamda, w=w, beta=betapoints[i], epsilon=epsilon)
}
plot(betapoints, out, type="l", ylab="objFun")

stepPenal documentation built on May 1, 2019, 10:11 p.m.

Related to objFun in stepPenal...