stat.bay.est {sma} | R Documentation

## Calculates an Odds Ratio for Each Gene in a Multi-slide Microarray Experiment.

### Description

This function takes independent, sufficient estimates of the effect and its variance for each gene in a multi-slide microarray experiment and returns an odds ratio for each gene: log( Pr(the gene is differentially expressed) / Pr(the gene is not differentially expressed) ). The parameter estimates of the Bayesian model used, as well as some data structures which are useful when presenting the lodscore graphically are also in the output.

### Usage

    stat.bay.est(M=NULL, Xprep=NULL, para=list(p = 0.01, v = NULL, a = NULL, c = NULL))

### Arguments

`M` | Matrix of (normalized) log expression ratios M = log_2 (R/G) (E.g. output from stat.ma())
`Xprep` | A list containing the effect estimates and variances for the genes, as well as some constants needed for the odds ratio
`para` | Estimates of the parameters used in the Bayesian calculations. (These are calculated only if not already supplied as input. See details!)

### Details

Xprep and para are optional input, but they are always in the output. If Xprep is supplied as input, M is unnecessary input. If Xprep is not supplied, stat.bay.est assumes the experiment consists of ncol(M) microarray slides all measuring the same effect (which will be stimated by Mbar). A subset of the parameters in para can be specified in the input, allowing the function to estimate only the others.

Xprep is a list containing

Mbar
  effect estimates for all genes (#genes x 1)
Vest
  estimates of sigma^2 (effect variances) for all genes (#genes x 1)
k
  constant so that Mbar~N(.,sigma^2/k) for all genes (1 x 1)
f
  degrees of freedom for Vest (1 x 1)

para is a list of parameters common to all genes containing

p
  Probability that a random gene is differentially expressed. Default is 0.01.
v,a
  Parameters in the prior for the variance such that a*k/(2*sigma^2) ~Gamma(v,1)
c
  Parameter in the prior for the mean expression ratio.

### Value

A list of

`Xprep` | Some data structures useful in graphical presentation. See details!
`para` | Estimates of the parameters used in the Bayesian calculations. See details!
`lods` | The log odds ratio for each gene.

### Author(s)

Ingrid Lönnstedt ingrid@math.uu.se

### References

I. Lönnstedt and T. P. Speed. Replicated Microarray Data. Statistical Sinica, Accepted, see http://www.stat.berkeley.edu/users/terry/zarray/Html/papersindex.html

### See Also

`stat.bayesian`,`plot.bayesian`

### Examples

    data(MouseArray)
    ## mouse.setup <- init.grid()
    ## mouse.data <- init.data() ## see \emph{init.data}
    ## mouse.lratio <- stat.ma(mouse.data, mouse.setup)

    mouse.bayesian<-stat.bay.est(M=mouse.lratio$M)
    plot(mouse.bayesian$Xprep$Mbar, mouse.bayesian$lods)

    #alternatively

    mouse.est<-apply(mouse.lratio$M,1,mean.na)
    mouse.Vest<-apply(mouse.lratio$M,1,var.na)
    n<-ncol(mouse.lratio$M)
    k<-n
    f<-n-1
    mouse.Xprep<-list(Mbar=mouse.est,Vest=mouse.Vest,k=k,f=f)

    mouse.bayest<-stat.bay.est(Xprep=mouse.Xprep)
    plot(mouse.bayest$Xprep$Mbar, mouse.bayest$lods)

[Package Contents]