This function conducts exact posterior inference based on a single 2x2 table.
1 2 3  singletable(y1=y1,n1=n1,y2=y2,n2=n2,measure=measure,model="Sarmanov",
method="exact",a1=0.5,b1=0.5,a2=0.5,b2=0.5,rho=0,alpha=0.05,
nsam=10000)

y1 
an integer indicating the number of events in group 1 
n1 
an integer indicating the total number of subjects in group 1 
y2 
an integer indicating the number of events in group 2 
n2 
an integer indicating the total number of subjects in group 2 
measure 
a character string specifying a measure. Options are

model 
a character string specifying the model. Options are

method 
a character string specifying the method. Options are

a1 
a numeric value specifying the first hyperparameter of the beta prior for group 1. Default value set to 0.5 
b1 
a numeric value specifying the second hyperparameter of the beta prior for group 1. Default value set to 0.5 
a2 
a numeric value specifying the first hyperparameter of the beta prior for group 2. Default value set to 0.5 
b2 
a numeric value specifying the second hyperparameter of the beta prior for group 2. Default value set to 0.5 
rho 
a numeric value specifying correlation coefficient for Sarmanov bivariate prior distribution. Default value set to 0. It is subject to constraints. See Details. 
alpha 
a numeric value specifying the significant level. Default value sets to 0.05. 
nsam 
a numeric value specifying the number of samples if method is "sampling". Default value sets to 
There are two kinds of study design, i.e., prospective study or
clinical trial, and retrospective or casecontrol study.
In a prospective study or clinical trial, data
is a data
frame that contains y1
, n1
, y2
, n2
,
studynames
. y1
is the number of subjects
experienced a certain event in the unexposed group. n1
is the number
of subjects in the unexposed group. y2
is the number of subjects experienced
a certain event in the exposed group. n2
is the number of
subjects in the exposed group. In this study, OR
is odds ratio
of event comparing exposed group with unexposed group. RR
is relative risk of event comparing exposed group with unexposed group. RD
is risk
difference of event comparing exposed group with unexposed group.
For casecontrol study, y1
is the number of subjects with
exposure in the control group. n1
is the number of
subjects in the control group. y2
is the number of
subjects with exposure in the case group. n2
is the
number of subjects in the case group. In this study, OR
is odds ratio
of event comparing case group with control group. RR
is
relative risk of event comparing case group with control group. RD
is risk
difference of event comparing case group with control group.
When model="Sarmanov"
, rho
is subject to constraints. See Chen et al (2011) for
details.
An object is returned, inheriting from class singletable
.
Objects of this class have methods for the generic functions summary
and plot
.
The following components must be included in a legitimate singletable
object.
measure 
the value of 
model 
the value of 
method 
the value of 
dataset 
a numeric vector of input data with components:

parameter 
a numeric vector of the hyperparameters:

alpha 
the value of 
sample 
a list of samples for the posterior and prior distributions 
density 
a list of the density of the posterior and prior distributions 
studynames 
a character vector specifying the study names. 
Luo, S., Chen, Y., Su, X., Chu, H., (2014). mmeta: An R Package for Multivariate MetaAnalysis. Journal of Statistical Software, 56(11), 126.
Chen, Y., Luo, S., (2011a). A Few Remarks on "Statistical Distribution of the Difference of Two Proportions' by Nadarajah and Kotz, Statistics in Medicine 2007; 26(18):35183523" . Statistics in Medicine, 30(15), 19131915.
Chen, Y., Chu, H., Luo, S., Nie, L., and Chen, S. (2014a). Bayesian analysis on metaanalysis of casecontrol studies accounting for withinstudy correlation. Statistical Methods in Medical Research, doi: 10.1177/0962280211430889. In press.
Chen, Y., Luo, S., Chu, H., Su, X., and Nie, L. (2014b). An empirical Bayes method for multivariate metaanalysis with an application in clinical trials. Communication in Statistics: Theory and Methods. In press.
Chen, Y., Luo, S., Chu, H., Wei, P. (2013). Bayesian inference on risk differences: an application to multivariate metaanalysis of adverse events in clinical trials. Statistics in Biopharmaceutical Research, 5(2), 142155.
multipletables
plot.singletable
summary.singletable
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38  # Inference under Jeffreys prior distribution
#single.OR.Jeffreys < singletable(a1=0.5, b1=0.5, a2=0.5,
# b2=0.5, y1=40, n1=96, y2=49, n2=109,
# model="Independent",
# measure="OR", method="exact")
#summary(single.OR.Jeffreys)
# Inference under Laplace prior distribution
#single.OR.Laplace < singletable(a1=1, b1=1, a2=1, b2=1,
# y1=40, n1=96, y2=49, n2=109,
# model="Independent", measure="OR",
# method="exact")
#summary(single.OR.Laplace)
# Inference under Sarmanov prior distribution with positive correlation
#single.OR.Sar1 < singletable(a1=0.5, b1=0.5, a2=0.5, b2=0.5,
# rho=0.5, y1=40, n1=96, y2=49, n2=109,
# model="Sarmanov",
# measure="OR", method="exact")
#summary(single.OR.Sar1)
# Inference under Sarmanov prior distribution with negative correlation
#single.OR.Sar2 < singletable(a1=0.5, b1=0.5, a2=0.5, b2=0.5,
# rho=0.5, y1=40, n1=96, y2=49, n2=109,
# model="Sarmanov",
# measure="OR", method="exact")
#summary(single.OR.Sar2)
# generate a 2X2 panel plot
#par(mfrow=c(2,2))
#plot(single.OR.Jeffreys, type="overlap", xlim=c(0.5, 2),
# main="Jefferys Prior",file="singleOR_Jef")
#plot(single.OR.Laplace, type="overlap", xlim=c(0.5, 2),
# main="Laplace Prior",file="singleOR_La")
#plot(single.OR.Sar1, type="overlap", xlim=c(0.5, 2),
# main=expression(paste("Sarmanov Prior ",rho," = 0.5")),file="singleOR_Sar1")
#plot(single.OR.Sar2, type="overlap", xlim=c(0.5, 2),
# main=expression(paste("Sarmanov Prior ",rho," = 0.5")),file="singleOR_Sar2")

Questions? Problems? Suggestions? Tweet to @rdrrHQ or email at ian@mutexlabs.com.
Please suggest features or report bugs with the GitHub issue tracker.
All documentation is copyright its authors; we didn't write any of that.