Description Usage Arguments Details Author(s) Examples
This function outputs the selected variables on each component for the sparse versions of the approaches (was also generalised to the non sparse versions for our internal functions).
1 2 3 4 5 6 7 8 9 10 | ## S3 method for class 'pls'
selectVar(object, comp =1, block=NULL,...)
## S3 method for class 'pca'
selectVar(object, comp =1, block=NULL,...)
## S3 method for class 'spls'
selectVar(object, comp =1, block=NULL,...)
## S3 method for class 'sgcca'
selectVar(object, comp =1, block=NULL, ...)
## S3 method for class 'rgcca'
selectVar(object, comp =1, block=NULL, ...)
|
object |
object of class inheriting from |
comp |
integer value indicating the component of interest. |
block |
for an object of class |
... |
other arguments. |
selectVar
provides the variables selected on a given component. \
name
outputs the name of the selected variables (provided that the input data have colnames) ranked in decreasing order of importance.
value
outputs the loading value for each selected variable, the loadings are ranked according to their absolute value.
These functions are only implemented for the sparse versions.
Kim-Anh LĂȘ Cao, Florian Rohart.
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 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 | data(liver.toxicity)
X = liver.toxicity$gene
Y = liver.toxicity$clinic
# example with sPCA
# ------------------
liver.spca <- spca(X, ncomp = 1, keepX = 10)
selectVar(liver.spca, comp = 1)$name
selectVar(liver.spca, comp = 1)$value
#example with sIPCA
# -----------------
## Not run:
liver.sipca <- sipca(X, ncomp = 3, keepX = rep(10, 3))
selectVar(liver.sipca, comp = 1)
## End(Not run)
# example with sPLS
# -----------------
## Not run:
liver.spls = spls(X, Y, ncomp = 2, keepX = c(20, 40),keepY = c(5, 5))
selectVar(liver.spls, comp = 2)
# example with sPLS-DA
data(srbct) # an example with no gene name in the data
X = srbct$gene
Y = srbct$class
srbct.splsda = splsda(X, Y, ncomp = 2, keepX = c(5, 10))
select = selectVar(srbct.splsda, comp = 2)
select
# this is a very specific case where a data set has no rownames.
srbct$gene.name[substr(select$select, 2,5),]
## End(Not run)
# example with sGCCA
# -----------------
## Not run:
data(nutrimouse)
# ! need to unmap the Y factor
Y = unmap(nutrimouse$diet)
data = list(gene = nutrimouse$gene, lipid = nutrimouse$lipid,Y)
# in this design, gene expression and lipids are connected to the diet factor
# and gene expression and lipids are also connected
design = matrix(c(0,1,1,
1,0,1,
1,1,0), ncol = 3, nrow = 3, byrow = T)
#note: the penalty parameters need to be tuned
wrap.result.sgcca = wrapper.sgcca(X = data, design = design, penalty = c(.3,.3, 1),
ncomp = 2,
scheme = "horst")
#variables selected and loadings values on component 1 for the two blocs
selectVar(wrap.result.sgcca, comp = 1, block = c(1,2))
#variables selected on component 1 for each block
selectVar(wrap.result.sgcca, comp = 1, block = c(1,2))$'gene'$name
selectVar(wrap.result.sgcca, comp = 1, block = c(1,2))$'lipid'$name
#variables selected on component 2 for each block
selectVar(wrap.result.sgcca, comp = 2, block = c(1,2))$'gene'$name
selectVar(wrap.result.sgcca, comp = 2, block = c(1,2))$'lipid'$name
# loading value of the variables selected on the first block
selectVar(wrap.result.sgcca, comp = 1, block = 1)$'gene'$value
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.