Learn R Programming

mixOmics (version 5.0-3)

select.var: Output of selected variables

Description

This function outputs the selected variables on each component for the sparse versions of the approaches.

Usage

## S3 method for class 'spls':
select.var(object, comp = 1, \ldots)
## S3 method for class 'splsda':
select.var(object, comp = 1, \ldots)
## S3 method for class 'spca':
select.var(object, comp = 1, \ldots)
## S3 method for class 'sipca':
select.var(object, comp = 1, \ldots)
## S3 method for class 'sgcca':
select.var(object, block = NULL, comp = 1,  \ldots)

Arguments

object
object of class inheriting from "spls", "splsda", "spca", "sipca".
comp
integer value indicating the component of interest.
block
for an object of class "sgcca", the block data sets can be specified as an input vector, for example c(1,2) for the first two blocks. Default to NULL (all block data sets)
...
other arguments.

encoding

latin1

Details

select.var provides the variables selected on a given component. \ [object Object],[object Object] These functions are only implemented for the sparse versions.

Examples

Run this code
data(liver.toxicity)
X = liver.toxicity$gene
Y = liver.toxicity$clinic

# example with sPCA
# ------------------
liver.spca <- spca(X, ncomp = 1, keepX = 10)
select.var(liver.spca, comp = 1)$name
select.var(liver.spca, comp = 1)$value

#example with sIPCA
# -----------------
liver.sipca <- sipca(X, ncomp = 3, keepX = rep(10, 3))
select.var(liver.sipca, comp = 1)

# example with sPLS
# -----------------
liver.spls = spls(X, Y, ncomp = 2, keepX = c(20, 40),keepY = c(5, 5))
select.var(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 = select.var(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),]

# example with sGCCA
# -----------------
data(nutrimouse)

# ! need to unmap the Y factor
Y = unmap(nutrimouse$diet)
data = list(nutrimouse$gene, 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(data = data, design = design, penalty = c(.3,.5, 1), 
                                  ncomp = c(2, 2, 1),
                                  scheme = "centroid", verbose = FALSE)

select = select.var(wrap.result.sgcca, comp = 1)
# loading value of the variables selected on the first block
select$value.var[[1]]

Run the code above in your browser using DataLab