Description Usage Arguments Value References Examples
Function to extract the coefficients of the PLS models.
1 2 3 |
object |
a sgspls object, parameters will be extracted from the object. |
type |
a vector of the type of coefficients to be extracted. Can be
the regression |
comps |
a vector of the components that should be returned. |
... |
not used currently. |
coef
returns a list with the required measures.
Liquet Benoit, Lafaye de Micheaux, Boris Hejblum, Rodolphe Thiebaut. A group and Sparse Group Partial Least Square approach applied in Genomics context. Submitted.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | set.seed(1)
n = 50; p = 500;
size.groups = 30; size.subgroups = 5
groupX <- ceiling(1:p / size.groups)
subgroupX <- ceiling(1:p / size.subgroups)
X = matrix(rnorm(n * p), ncol = p, nrow = n)
beta <- rep(0,p)
bSG <- -2:2; b0 <- rep(0,length(bSG))
betaG <- c(bSG, b0, bSG, b0, bSG, b0)
beta[1:size.groups] <- betaG
y = X %*% beta + 0.1*rnorm(n)
model <- sgspls(X, y, ncomp = 3, mode = "regression", keepX = 1,
groupX = groupX, subgroupX = subgroupX,
indiv_sparsity_x = 0.8, subgroup_sparsity_x = 0.15)
# get the regression coefficients
model_coef <- coef(model, type = "coefficients", comps = 3)
# check fit
cbind(beta, model_coef$B)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.