Description Usage Arguments Author(s) Examples
Build an spls model with shrinkage and selection by the LASSO.
1 |
x |
|
y |
|
K |
|
eta |
|
kappa |
|
select |
|
fit |
|
scale.x |
|
scale.y |
|
eps |
|
maxstep |
|
trace |
Wesley Brooks
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | ##---- Should be DIRECTLY executable !! ----
##-- ==> Define data, use random,
##-- or do help(data=index) for the standard data sets.
## The function is currently defined as
function (x, y, K = NULL, eta = seq(0.05, 0.95, 0.05), kappa = 0.5,
select = "pls2", fit = "simpls", scale.x = TRUE, scale.y = FALSE,
eps = 1e-04, maxstep = 100, trace = FALSE)
{
result = list()
class(result) = "spls.wrap"
if (is.null(K)) {
max.K = min(ncol(x), floor(nrow(x)/10))
K = 1:max.K
}
cv = cv.spls(x = x, y = y, K = K, eta = eta, fit = fit, select = select,
scale.x = scale.x, scale.y = scale.y)
m = spls(x = x, y = y, K = cv$K.opt, eta = cv$eta.opt, kappa = kappa,
select = select, fit = fit, scale.x = scale.x, scale.y = scale.y,
eps = eps, maxstep = maxstep, trace = trace)
ci = ci.spls(m, plot.it = FALSE)
coef = correct.spls(ci)
result[["coef"]] = coef
result[["vars"]] = rownames(coef)
}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.