SingleTable.create: Create an object of class 'singletable'.

View source: R/SingleTable-methods-exported.R

SingleTable.createR Documentation

Create an object of class singletable.

Description

Create an object of class SingleTable, which is a components list of exact posterior inference based on single 2x2 table.

Usage

SingleTable.create(a1,b1,a2,b2,rho,y1,n1,y2,n2,model,measure)

Arguments

a1

a numeric value specifying the first hyperparameter of the beta prior for group 1.

b1

a numeric value specifying the second hyperparameter of the beta prior for group 1.

a2

a numeric value specifying the first hyperparameter of the beta prior for group 2.

b2

a numeric value specifying the second hyperparameter of the beta prior for group 2.

rho

a numeric value specifying correlation coefficient for Sarmanov bivariate prior distribution.

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.

model

a character string specifying the model. Options are Independent and Sarmanov. Independent is independent beta-binomial model. Sarmanovis Sarmanov beta-binomial model.

measure

a character string specifying a measure. Options are OR, RR, and RD. OR is odds ratio, RR is relative risk, and RD is risk difference.

Details

There are two kinds of study design, i.e., prospective study or clinical trial, and retrospective or case-control study. In a prospective study or clinical trial, data is a data frame that contains y1, n1, y2, n2. 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 case-control 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.

Value

An object is returned, inheriting from class singletable. The Objects of this class contain the meta-data for generic functions: SingleTable.modelFit, SingleTable.summary, and SingleTable.plot. The following values of the object must be non-null under SingleTable.create:

measure

the value of measure argument.

model

the value of model argument.

data

a numeric vector of input data with components: y1, n1, y2, n2

parameter

a numeric vector of the hyperparameters: a1, b1, a2, b2, and rho.

References

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):3518-3523".
Statistics in Medicine, 30(15), 1913-1915.
<doi:10.1002/sim.4248>

See Also

SingleTable.modelFit, SingleTable.summary, SingleTable.plot.

Examples

## Specify data (y1, n1, y2, n2), parameters (a1, b1, a2, b2, rho), model (Sarmanov/Independent),
## and Specify measure(OR/RR/RD)
## Assume we have a 2x2 table:{{40,56},{49,60}} and set prior parameters as a1=b1=a2=b2=rho=0.5.
## Create object \code{single_table_obj}
 
 library(mmeta)
 library(ggplot2)
 single_table_obj <- SingleTable.create(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")

mmeta documentation built on Feb. 16, 2023, 8:39 p.m.