An object of class
matrix,
ExpressionSet,
vsn or
MAList.
ranks
Logical, indicating whether the x-axis (means) should be plotted
on the original scale (FALSE) or on the rank scale (TRUE). The latter
distributes the data more evenly along the x-axis and allows a
better visual assessment of the standard deviation as a function of
the mean.
xlab
Character, label for the x-axis.
ylab
Character, label for the y-axis.
pch
Ignored - exists for backward compatibility.
plot
Logical. If TRUE (default), a plot is produced.
Calling the function with plot=FALSE can be useful if only
its return value is of interest.
bins
Gets passed on to stat_binhex.
...
Further arguments that get passed on to stat_binhex.
Details
Standard deviation and mean are calculated row-wise from the
expression matrix (in) x. The scatterplot of these versus each other
allows you to visually verify whether there is a dependence of the standard
deviation (or variance) on the mean.
The red line depicts the running median estimator (window-width 10%).
If there is no variance-mean dependence, then the line should be approximately horizontal.
Value
A named list with five components: its elements px and
py are the x- and y-coordinates of the individual data points
in the plot; its first and second element are the x-coordinates and values of
the running median estimator (the red line in the plot).
Its element gg is the plot object (see examples).
Depending on the value of plot, the method can (and by default does) have a side effect,
which is to print gg on the active graphics device.
Author(s)
Wolfgang Huber
See Also
vsn
Examples
data("kidney")
log.na <- function(x) log(ifelse(x>0, x, NA))
exprs(kidney) <- log.na(exprs(kidney))
msd <- meanSdPlot(kidney)
## The `ggplot` object is returned in list element `gg`, here is an example of how to modify the plot
library("ggplot2")
msd$gg + ggtitle("Hello world") + scale_fill_gradient(low = "yellow", high = "darkred") + scale_y_continuous(limits = c(0, 7))
## Try this out with not log-transformed data, vsn2-transformed data, the lymphoma data, your data ...
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(vsn)
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")'.
> png(filename="/home/ddbj/snapshot/RGM3/R_BC/result/vsn/meanSdPlot.Rd_%03d_medium.png", width=480, height=480)
> ### Name: meanSdPlot
> ### Title: Plot row standard deviations versus row means
> ### Aliases: meanSdPlot meanSdPlot-methods meanSdPlot,matrix-method
> ### meanSdPlot,ExpressionSet-method meanSdPlot,vsn-method
> ### meanSdPlot,MAList-method
> ### Keywords: hplot methods
>
> ### ** Examples
>
> data("kidney")
> log.na <- function(x) log(ifelse(x>0, x, NA))
>
> exprs(kidney) <- log.na(exprs(kidney))
> msd <- meanSdPlot(kidney)
Warning message:
Removed 898 rows containing non-finite values (stat_binhex).
>
> ## The `ggplot` object is returned in list element `gg`, here is an example of how to modify the plot
> library("ggplot2")
> msd$gg + ggtitle("Hello world") + scale_fill_gradient(low = "yellow", high = "darkred") + scale_y_continuous(limits = c(0, 7))
Scale for 'fill' is already present. Adding another scale for 'fill', which
will replace the existing scale.
Warning messages:
1: Removed 898 rows containing non-finite values (stat_binhex).
2: Removed 49 rows containing missing values (geom_hex).
>
> ## Try this out with not log-transformed data, vsn2-transformed data, the lymphoma data, your data ...
>
>
>
>
>
> dev.off()
null device
1
>