Learn R Programming

bacon (version 1.0.4)

bacon: 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, 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))))

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 leve used to determine prop. null for starting values
verbose
default FALSE
priors
list of parameters of for the prior distributions

Value

object of class-Bacon

References

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

Examples

Run this code
##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))

Run the code above in your browser using DataLab