MCPAN (version 1.1-21)

multinomORci: Simultaneous confidence intervals for odds ratios comparing multiple odds and multiple treatments in a contingency table

Description

Testversion. Two methods are provided to compute simultaneous confidence intervals for the comparison of several types of odds between several multinomial samples. Asymptotic Wald-type intervals (incl. replacing zero by some small number) as well as a method that computes simultaneous percentile intervals based on samples from the joint Dirichlet-posterior distribution with vague prior. A separate multinomial distribution is assumed for each row of the contingency table.

Usage

multinomORci(Ymat, cmcat=NULL, cmgroup=NULL, cimethod = "DP", 
alternative = "two.sided", conf.level = 0.95, 
bycomp = FALSE, bychr = " btw ", ...)

Arguments

Ymat

a matrix or table: input data as a 2-dimensional contingency table, containing the counts of the categories in the different treatment groups, with rows of the table representing the treatment groups and columns of the table representing the categories. Also data.frames can be provided given that they contain counts only. Names of treatments/groups may be attached as row.names, names of categories may be attached as col.names.

cmcat

a matrix or a character string: the contrast matrix that specifies which odds to compute between the categories. Column number of cmcat must be equal to the column number of Ymat; or, a character string ("Dunnett", "Tukey") invoking baseline odds or all pairwise odds between categories; if NULL baseline odds are computed

cmgroup

a matrix or a character string: the contrast matrix that specifies, which treatment groups should be compared. Column number of cmgroup must be equal to the row number of Ymat; or, a character string ("Dunnett", "Tukey") invoking comparisons to the first group or all pairwise comparisons between groups; if NULL comparisons to control are computed

cimethod

character string specifyoing the method for computation: "DP" invokes use of the sampling method based on the Drirchlet posterior with vague prior; "Wald" invokes use of an asmptotic method;

alternative

single character string: "two.sided": two-sicded intervals; "less" intervals with upper limits only; "greater" intervals with lower limits only.

conf.level

single number: the simultaneous confidcence level

bycomp

logical, if bycomp=FALSE parameters are ordered by odds first; if bycomp=TRUE parameters are ordered by between-group-comparison first

bychr

character string separating the name of the odds from the name of the between group comparison in the output

further arguments to be passed to the internal functions: if cimethod = "DP" argument BSIM (defaults to BSIM=10000) defines the number of samples drwan from the Dirichlet posterior, and prior allows to define a single number, vector or matrix of alpha-parameters for the Dirichlet prior. If not specified, Dirichlet(1,1,...,1) is used as a prior, independent for each treatemnet group. if cimethod = "Wald", argument addx sets the quantity to be added to each cell/row/total of the contingency table.

Value

A list with items

SCI

a data.frame with names of comprisons as well as the lower and upper confidence limits

details

a list with computational details depending on the cimethod: for "DP", the prior parameters, the complete sample from posterior, etc.) , for "Wald"-type (observations added to the table, estimated correlation matrix and covariance matrix, mulivariate normal quantiles)

Details

Testversion.

See Also

as.data.frame.multinomORci, print.multinomORci

Examples

Run this code
# NOT RUN {
# Randomized clinical trial 2 treatment groups (injection of saline or sterile water)
# to cure chronic pain after whiplash injuries. Response are 3 (ordered) categories,
# 'no change', 'improved', 'much improved'. Source: Hand, Daly, Lunn, McConway,
# Ostrowski (1994): A handbook of small data sets. Chapman & Hall, Example 124, page 993


dwi <- data.frame("no.change"=c(1,14), "improved"=c(9,3), "much.improved"=c(10,3))
rownames(dwi) <- c("sterile3", "saline3")

dwi

DP1dwi <- multinomORci(Ymat=dwi, cmcat="Dunnett", cmgroup="Tukey", cimethod="DP", BSIM=5000)
DP1dwi 

# at logit-scale (i.e., not backtransformation)
print(DP1dwi , exp=FALSE)

# }
# NOT RUN {
# Compute asymptotic Wald-type intervals
Waldwbc <- multinomORci(Ymat=dwi, cmcat="Dunnett", cmgroup="Tukey", cimethod="Wald")
Waldwbc
print(Waldwbc, exp=FALSE)
# }
# NOT RUN {
# }

Run the code above in your browser using DataLab