R: The Iterative Bayesian Model Averaging (BMA) algorithm
iterativeBMA-package
R Documentation
The Iterative Bayesian Model Averaging (BMA) algorithm
Description
The iterative Bayesian Model Averaging (BMA) algorithm is a variable
selection and classification algorithm with an application of
classifying 2-class microarray samples, as described in Yeung,
Bumgarner and Raftery (Bioinformatics 2005, 21: 2394-2402).
Details
Package:
iterativeBMA
Type:
Package
Version:
0.1.0
Date:
2005-12-30
License:
GPL version 2 or higher
The function iterateBMAglm.train selects relevant variables by
iteratively applying the bic.glm function from the BMA package.
The data is assumed to consist of two classes.
The function iterateBMAglm.train.predict combines the training
and prediction phases, and returns the predicted posterior probabilities
that each test sample belongs to class 1.
The function iterateBMAglm.train.predict.test combines the training,
prediction and test phases, and returns a list consisting of the
numbers of selected genes and models using the training data, the number
of classification errors and the Brier Score on the test set.
Author(s)
Ka Yee Yeung, University of Washington, Seattle, WA, with
contributions from Adrian Raftery and Ian Painter
Maintainer: Ka Yee Yeung <kayee@u.washington.edu>
References
Yeung, K.Y., Bumgarner, R.E. and Raftery, A.E. (2005)
Bayesian Model Averaging: Development of an improved multi-class, gene selection and classification tool for microarray data.
Bioinformatics 21: 2394-2402.
library (Biobase)
library (BMA)
library (iterativeBMA)
data(trainData)
data(trainClass)
## training phase: select relevant genes
ret.bic.glm <- iterateBMAglm.train (train.expr.set=trainData, trainClass, p=100)
## get the selected genes with probne0 > 0
ret.gene.names <- ret.bic.glm$namesx[ret.bic.glm$probne0 > 0]
data (testData)
## get the subset of test data with the genes from the last iteration of bic.glm
curr.test.dat <- t(exprs(testData)[ret.gene.names,])
## to compute the predicted probabilities for the test samples
y.pred.test <- apply (curr.test.dat, 1, bma.predict, postprobArr=ret.bic.glm$postprob, mleArr=ret.bic.glm$mle)
## compute the Brier Score if the class labels of the test samples are known
data (testClass)
brier.score (y.pred.test, testClass)
Results
R version 3.3.1 (2016-06-21) -- "Bug in Your Hair"
Copyright (C) 2016 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)
R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.
R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.
Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.
> library(iterativeBMA)
Loading required package: BMA
Loading required package: survival
Loading required package: leaps
Loading required package: robustbase
Attaching package: 'robustbase'
The following object is masked from 'package:survival':
heart
Loading required package: inline
Loading required package: rrcov
Scalable Robust Estimators with High Breakdown Point (version 1.3-11)
Loading required package: Biobase
Loading required package: BiocGenerics
Loading required package: parallel
Attaching package: 'BiocGenerics'
The following objects are masked from 'package:parallel':
clusterApply, clusterApplyLB, clusterCall, clusterEvalQ,
clusterExport, clusterMap, parApply, parCapply, parLapply,
parLapplyLB, parRapply, parSapply, parSapplyLB
The following objects are masked from 'package:stats':
IQR, mad, xtabs
The following objects are masked from 'package:base':
Filter, Find, Map, Position, Reduce, anyDuplicated, append,
as.data.frame, cbind, colnames, do.call, duplicated, eval, evalq,
get, grep, grepl, intersect, is.unsorted, lapply, lengths, mapply,
match, mget, order, paste, pmax, pmax.int, pmin, pmin.int, rank,
rbind, rownames, sapply, setdiff, sort, table, tapply, union,
unique, unsplit
Welcome to Bioconductor
Vignettes contain introductory material; view with
'browseVignettes()'. To cite Bioconductor, see
'citation("Biobase")', and for packages 'citation("pkgname")'.
Attaching package: 'Biobase'
The following object is masked from 'package:robustbase':
rowMedians
> png(filename="/home/ddbj/snapshot/RGM3/R_BC/result/iterativeBMA/iterativeBMA-package.Rd_%03d_medium.png", width=480, height=480)
> ### Name: iterativeBMA-package
> ### Title: The Iterative Bayesian Model Averaging (BMA) algorithm
> ### Aliases: iterativeBMA-package iterativeBMA
> ### Keywords: multivariate classif
>
> ### ** Examples
>
> library (Biobase)
> library (BMA)
> library (iterativeBMA)
> data(trainData)
> data(trainClass)
>
> ## training phase: select relevant genes
> ret.bic.glm <- iterateBMAglm.train (train.expr.set=trainData, trainClass, p=100)
[1] "5: explored up to variable ## 100"
There were 50 or more warnings (use warnings() to see the first 50)
>
> ## get the selected genes with probne0 > 0
> ret.gene.names <- ret.bic.glm$namesx[ret.bic.glm$probne0 > 0]
>
> data (testData)
>
> ## get the subset of test data with the genes from the last iteration of bic.glm
> curr.test.dat <- t(exprs(testData)[ret.gene.names,])
>
> ## to compute the predicted probabilities for the test samples
> y.pred.test <- apply (curr.test.dat, 1, bma.predict, postprobArr=ret.bic.glm$postprob, mleArr=ret.bic.glm$mle)
>
> ## compute the Brier Score if the class labels of the test samples are known
> data (testClass)
> brier.score (y.pred.test, testClass)
[1] 2.106802
>
>
>
>
>
> dev.off()
null device
1
>