objFun {stepPenal} | R Documentation |
Objective function
Description
Objective (non-convex) function to minimize (objFun=-logL+ lamda*CL, CL= (1-w)L0 + wL1)
Usage
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
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")
[Package stepPenal version 0.2 Index]