select.sgspls: Find selected Modules, Genes and Times

Description Usage Arguments Value Examples

Description

This function finds the selected groups, subgroups and individual predictors from a sgspls method.

Usage

1
select.sgspls(model, module, gene, time)

Arguments

model

object of class inhereting from "sgspls".

module

A p-vector indicating group membership for each covariate in the X-block

gene

A p-vector indicating gene membership for each covariate in the X-block

time

A p-vector indicating time membership for each covariate in the X-block

Value

Returns a list with the following selected parameter information:

select.table.X

A table detailing the number of times each gene has been selected at each timepoint and the number of consistently selected genes.

summary.table

A table sumarising the number of modules, genes, timepoints and covariates selected.

tab.gene.X

Lists the number of timepoint that each gene in a given module and component occurs.

tab.gene.time.X

Table of the selected genes against time points that they occur.

consistent.genes.X

Returns the genes that occur in every time point.

select.gene.X

Returns the genes that are selected at least once for a given component.

select.gene.X.total

Returns the genes that are selected at least once across any component.

selected.table.gene.X

Returns the total number of genes selected at each component.

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
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
set.seed(1)
n = 50; p = 510; 

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)

# Beta contains 1 active module with 3 active genes
# index for modules, genes and times
mod_index <- groupX
gene_index <- subgroupX
time_index <- rep(rep(1:5,6), 17)

model <- sgspls(X, y, ncomp = 3, mode = "regression", keepX = 1,
                groupX = groupX, subgroupX = subgroupX,
                indiv_sparsity_x = 0.8, subgroup_sparsity_x = 0.15)

reg_coef <- coef(model, type = "coefficients")

# Check model fit
cbind(reg_coef$B[ , , 3], beta)

# See the estimated regression coefficient
cbind(reg_coef$B[,,3], beta, mod_index, gene_index, time_index)[1:30,]
selectedVar <- select.sgspls(model, module = mod_index, gene = gene_index, time = time_index)
# show number of selected genes for component 1
selectedVar$select.table.X$comp1
# show number of modules, genes, times and total variables selected
selectedVar$summary.table
# Show when genes were selected from given module

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