bacon: Gibbs sampler

View source: R/bacon.R

baconR Documentation

Gibbs sampler

Description

Gibbs Sampler Algorithm to fit a three component normal mixture to z-scores

Usage

bacon(
  teststatistics = NULL,
  effectsizes = NULL,
  standarderrors = NULL,
  niter = 5000L,
  nburnin = 2000L,
  nbins = 1000,
  trim = 0.999,
  level = 0.05,
  na.exclude = FALSE,
  verbose = FALSE,
  priors = list(sigma = list(alpha = 1.28, beta = 0.36), mu = list(lambda = c(0, 3, -3),
    tau = c(1000, 100, 100)), epsilon = list(gamma = c(90, 5, 5))),
  globalSeed = 42,
  parallelSeed = 42
)

Arguments

teststatistics

numeric vector or matrix of test-statistics

effectsizes

numeric vector or matrix of effect-sizes

standarderrors

numeric vector or matrix of standard errors

niter

number of iterations

nburnin

length of the burnin period

nbins

default 1000 else bin test-statistics

trim

default 0.999 trimming test-statistics

level

significance level used to determine prop. null for starting values

na.exclude

see ?na.exclude

verbose

default FALSE

priors

list of parameters for the prior distributions

globalSeed

default 42 global seed. If set to NULL, randomization will occur for sequential and parallel bacon calls

parallelSeed

default 42 BiocParallel RNGseed. If input statistics are a matrix and globalSeed=NULL, setting parallelSeed=NULL will allow randomization across parallel processes within a bacon call and across separate calls to bacon.

Value

object of class-Bacon

Author(s)

mvaniterson

References

Implementation is based on a version from Zhihui Liu https://macsphere.mcmaster.ca/handle/11375/9368

Examples

##simulate some test-statistic from a normal mixture
##and run bacon
y <- rnormmix(2000, c(0.9, 0, 1, 0, 4, 1))
bc <- bacon(y)
##extract all estimated mixture parameters
estimates(bc)
##extract inflation
inflation(bc)
##extract bias
bias(bc)

##extract bias and inflation corrected test-statistics
head(tstat(bc))

##inspect the Gibbs Sampling output
traces(bc)
posteriors(bc)
fit(bc)

##simulate multiple sets of test-statistic from a normal mixture
##and run bacon
y <- matrix(rnormmix(10*2000, c(0.9, 0, 1, 0, 4, 1)), ncol=10)
bc <- bacon(y)
##extract all estimated mixture parameters
estimates(bc)
##extract only the inflation
inflation(bc)
##extract only the bias
bias(bc)
##extract bias and inflation corrected P-values
head(pval(bc))
##extract bias and inflation corrected test-statistics
head(tstat(bc))

mvaniterson/bacon documentation built on April 19, 2024, 5:32 p.m.