hem.eb.prior {HEM} | R Documentation

## Empirical Bayes (EB) Prior Specification

### Description

Estimates experimental and biological variances by LPE and resampling

### Usage

    hem.eb.prior(dat, tr=" ",  n.layer, design,
                 method.var.e="neb", method.var.b="peb", method.var.t="neb",
                 q=0.01, B=25, n.digits=10, print.message.on.screen=TRUE)

### Arguments

`dat` | data
`tr` | if "log2", "log10", or "loge", then log-transformation (with base 2, 10, or e respectively) is taken.
`n.layer` | number of layers
`design` | design matrix
`method.var.e` | prior specification method for experimental variance; "peb"=parametric EB prior specification, "neb"=nonparametric EB prior specification
`method.var.b` | prior specification method for biological variance; "peb"=parametric EB prior specification
`method.var.t` | prior specification method for total variance; "peb"=parametric EB prior specification, "neb"=nonparametric EB prior specification
`q` | quantile for paritioning genes based on expression levels
`B` | number of iterations for resampling
`n.digits` | number of digits
`print.message.on.screen` | if TRUE, process status is shown on screen.

### Value

`var.b` | prior estimate matrix for biological variances (n.layer=2)
`var.e` | prior estimate matrix for experiemtnal variances (n.layer=2)
`var.t` | prior estimate matrix for total variances (n.layer=1)

### Author(s)

HyungJun Cho, PhD, and Jae K. Lee, PhD,

### See Also

`hem`, `hem.fdr`

### Examples

    #Example 1: Two-layer HEM with EB prior specification

    data(pbrain)

    ##construct a design matrix
    cond <- c(1,1,1,1,1,1,2,2,2,2,2,2)
    ind  <- c(1,1,2,2,3,3,1,1,2,2,3,3)
    rep  <- c(1,2,1,2,1,2,1,2,1,2,1,2)
    design <- data.frame(cond,ind,rep)

    ##normalization
    pbrain.nor <- hem.preproc(pbrain[,2:13])

    ##take a subset for a testing purpose;
    ##use all genes for a practical purpose
    pbrain.nor <- pbrain.nor[1:1000,]

    ##estimate hyperparameters of variances by LPE
    pbrain.eb  <- hem.eb.prior(pbrain.nor, n.layer=2,  design=design,
                               method.var.e="neb", method.var.b="peb")

    #fit HEM with two layers of error
    #using the small numbers of burn-ins and MCMC samples for a testing purpose;
    #but increase the numbers for a practical purpose
    pbrain.hem <- hem(pbrain.nor, n.layer=2,  design=design,burn.ins=10, n.samples=30,
                  method.var.e="neb", method.var.b="peb",
                  var.e=pbrain.eb$var.e, var.b=pbrain.eb$var.b)

    #Example 2: One-layer HEM with EB prior specification

    data(mubcp)

    ##construct a design matrix
    cond <- c(rep(1,6),rep(2,5),rep(3,5),rep(4,5),rep(5,5))
    ind  <- c(1:6,rep((1:5),4))
    design <- data.frame(cond,ind)

    ##normalization
    mubcp.nor <- hem.preproc(mubcp)

    ##take a subset for a testing purpose;
    ##use all genes for a practical purpose
    mubcp.nor <- mubcp.nor[1:1000,]

    ##estimate hyperparameters of variances by LPE
    mubcp.eb  <- hem.eb.prior(mubcp.nor, n.layer=1, design=design,
                 method.var.t="neb")

    #fit HEM with two layers of error
    #using the small numbers of burn-ins and MCMC samples for a testing purpose;
    #but increase the numbers for a practical purpose
    mubcp.hem <- hem(mubcp.nor, n.layer=1, design=design,  burn.ins=10, n.samples=30,
                 method.var.t="neb", var.t=mubcp.eb$var.t)

    ###NOTE: see help(hem.fdr) for examples with FDR evaluation
    ###NOTE: see help(hem) for examples without EB

[Package HEM version 1.0.4 Index]