coef.sgspls: Compute regression coefficients, loadings and

Description Usage Arguments Value References Examples

Description

Function to extract the coefficients of the PLS models.

Usage

1
2
3
## S3 method for class 'sgspls'
coef(object, type = c("coefficients", "loadings",
  "adjusted_weights"), comps = NULL, ...)

Arguments

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 coefficients, the loadings, the adjusted_weights or any subset of these.

comps

a vector of the components that should be returned.

...

not used currently.

Value

coef returns a list with the required measures.

References

Liquet Benoit, Lafaye de Micheaux, Boris Hejblum, Rodolphe Thiebaut. A group and Sparse Group Partial Least Square approach applied in Genomics context. Submitted.

Examples

 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)

matt-sutton/sgspls documentation built on June 22, 2019, 10:21 a.m.