nc.hdsvm | R Documentation |
This function fits the penalized SVM using nonconvex penalties such as SCAD or MCP. It allows for flexible control over the regularization parameters and offers advanced options for initializing and optimizing the fit.
nc.hdsvm(
x,
y,
lambda,
pen = "scad",
aval = NULL,
lam2 = 1,
ini_beta = NULL,
lla_step = 3,
...
)
x |
Matrix of predictors, with dimensions (nobs * nvars); each row represents an observation. |
y |
Response variable, with length |
lambda |
Optional user-supplied sequence of |
pen |
Specifies the type of nonconvex penalty: "SCAD" or "MCP". |
aval |
The parameter value for the SCAD or MCP penalty. Default is 3.7 for SCAD and 2 for MCP. |
lam2 |
Regularization parameter |
ini_beta |
Optional initial coefficients to start the fitting process. |
lla_step |
Number of Local Linear Approximation (LLA) steps. Default is 3. |
... |
Additional arguments passed to |
An object with S3 class nc.hdsvm
consisting of
call |
the call that produced this object |
b0 |
intercept sequence of length |
beta |
a |
lambda |
the actual sequence of |
df |
the number of nonzero coefficients for each value
of |
npasses |
the number of iterations for every lambda value |
jerr |
error flag, for warnings and errors, 0 if no error. |
#'
set.seed(315)
n <- 100
p <- 400
x1 <- matrix(rnorm(n / 2 * p, -0.25, 0.1), n / 2)
x2 <- matrix(rnorm(n / 2 * p, 0.25, 0.1), n / 2)
x <- rbind(x1, x2)
beta <- 0.1 * rnorm(p)
prob <- plogis(c(x %*% beta))
y <- 2 * rbinom(n, 1, prob) - 1
lam2 <- 0.01
lambda <- 10^(seq(1,-4, length.out = 30))
nc.fit <- nc.hdsvm(x = x, y = y, lambda = lambda, lam2 = lam2, pen = "scad")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.