Package 'MCPAN'

Title: Multiple Comparisons Using Normal Approximation
Description: Multiple contrast tests and simultaneous confidence intervals based on normal approximation. With implementations for binomial proportions in a 2xk setting (risk difference and odds ratio), poly-3-adjusted tumour rates, biodiversity indices (multinomial data) and expected values under lognormal assumption. Approximative power calculation for multiple contrast tests of binomial and Gaussian data.
Authors: Frank Schaarschmidt [aut, cre], Daniel Gerhard [aut], Martin Sill [aut]
Maintainer: Frank Schaarschmidt <[email protected]>
License: GPL-2
Version: 1.1-21
Built: 2024-11-20 06:52:33 UTC
Source: CRAN

Help Index


Multiple comparison procedures based on normal approximation and extensions.

Description

Multiple contrast tests and simultaneous confidence intervals using normal approximation, if individuals are randomly assigned to treatments in a oneway layout. For some cases improvements compared to crude normal approximation are implemented.

Details

Package: MCPAN
Type: Package
Version: 1.1-21
Date: 2018-03-22
License: GPL

For dichotomous variables, approximate confidence intervals for the risk difference (Schaarschmidt et al. 2008) and odds ratio (Holford et al. 1989) are available. The implementation of multiple contrast methods for the risk ratio and the odds ratio may be seen as a generalization of methods in Holford et al. (1989), and the crude normal approximation as described in Gart and Nam (1988) as special cases of the framework described in Hothorn et al. (2008). If the variable of interest is the rate of tumours in long-term rodent carcinogenicity trials (without cause of death information), confidence intervals for poly-k-adjusted tumour rates (Bailer and Portier, 1988) are available, as described in Schaarschmidt et al. (2008). For abundance data of multiple species, asymptotic simultaneous confidence intervals for differences of Simpson and Shannon-indices are implemented, assuming multinomial count data (Rogers and Hsu, 2001, Fritsch and Hsu, 1999, Scherer et al., 2013). For expected values of lognormal samples, asymptotic Wald-type intervals and a sampling based improvement are available (Schaarschmidt, 2013).

Author(s)

Frank Schaarschmidt, Daniel Gerhard, Martin Sill Maintainer: Frank Schaarschmidt <[email protected]>

References

Schaarschmidt, F., Sill, M., and Hothorn, L.A. (2008): Approximate Simultaneous Confidence Intervals for Multiple Contrasts of Binomial Proportions. Biometrical Journal 50, 782-792.

Schaarschmidt, F., Sill, M., and Hothorn, L.A. (2008): Poly-k-trend tests for survival adjusted analysis of tumor rates formulated as approximate multiple contrast test. Journal of Biopharmaceutical Statistics 18, 934-948.

Holford, T.R., Walter, S.D. and Dunnett, C.W. (1989): Simultaneous interval estimates of the odds ratio in studies with two or more comparisons. Journal of Clinical Epidemiology 42, 427-434.

Gart, J.J. and Nam, J. (1988): Approximate interval estimation of the ratio of binomial parameters: A review and corrections for skewness. Biometrics 44, 323-338.

Schaarschmidt, F. (2013). Simultaneous confidence intervals for multiple comparisons among expected values of log-normal variables. Computational Statistics and Data Analysis 58, 265-275.

Hothorn, T., Bretz. F, and Westfall, P. (2008): Simultaneous inference in general parametric models. Biometrical Journal 50(3), 346-363.

Bailer, J.A. and Portier, C.J. (1988): Effects of treatment-induced mortality and tumor-induced mortality on tests for carcinogenicity in small samples. Biometrics 44, 417-431.

Bretz, F., Hothorn, L. (2002): Detecting dose-response using contrasts: asymptotic power and sample size determination for binomial data. Statistics in Medicine 21: 3325-3335.

Rogers, J.A. and Hsu, J.C. (2001): Multiple Comparisons of Biodiversity. Biometrical Journal 43, 617-625.

Fritsch, K.S., and Hsu, J.C. (1999): Multiple Comparison of Entropies with Application to Dinosaur Biodiversity. Biometrics 55, 1300-1305.

Scherer, R., Schaarschmidt, F., Prescher, S., and Priesnitz, K.U. (2013): Simultaneous confidence intervals for comparing biodiversity indices estimated from overdispersed count data. Biometrical Journal 55, 246-263.

Examples

# # # 1)
# Simultaneous confidence intervals 
# for 2xk tables of binomial data: 
# binomRDtest, binomRDci

# Difference of proportions

binomRDci(x=c(2,6,4,13), n=c(34,33,36,34),
 names=c("Placebo", "50", "75", "150"),
 type="Dunnett", method="ADD1")

# Odds ratios:

binomORci(x=c(2,6,4,13), n=c(34,33,36,34),
 names=c("Placebo", "50", "75", "150"),
 type="Dunnett")


# # # 
# Simultaneous confidence intervals for comparing a treatment
# (trt) to 3 controls (Var1-Var3) in terms of differences of
# Simpson indices for a community comprising 33 species.

PSM <-
as.data.frame(structure(c(0, 0, 2, 0, 0, 2, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 
2, 1, 1, 1, 0, 1, 2, 50, 25, 29, 42, 1, 1, 0, 3, 14, 6, 6, 24, 
64, 56, 121, 98, 1, 1, 1, 4, 410, 357, 586, 588, 16, 29, 21, 
38, 1, 1, 1, 1, 7, 12, 7, 11, 0, 1, 0, 0, 0, 1, 0, 0, 1, 1, 4, 
1, 4, 3, 11, 4, 0, 0, 1, 0, 0, 1, 5, 0, 0, 0, 1, 1, 0, 0, 1, 
0, 30, 31, 10, 42, 0, 0, 1, 0, 7, 8, 10, 13, 111, 125, 112, 73, 
2, 1, 0, 0, 67, 64, 81, 102, 0, 0, 1, 0, 0, 0, 0, 1, 21, 20, 
14, 24, 0, 1, 0, 0), .Dim = c(4L, 33L), .Dimnames = list(c("Trt", 
"Var1", "Var2", "Var3"), c("Sp1", "Sp2", "Sp3", "Sp4", "Sp5", "Sp6", 
"Sp7", "Sp8", "Sp9", "Sp10", "Sp11", "Sp12", "Sp13", "Sp14", 
"Sp15", "Sp16", "Sp17", "Sp18", "Sp19", "Sp20", "Sp21", "Sp22", 
"Sp23", "Sp24", "Sp25", "Sp26", "Sp27", "Sp28", "Sp29", "Sp30", 
"Sp31", "Sp32", "Sp33"))))

fvar<-factor(row.names(PSM), levels=row.names(PSM))

Simpsonci(X=PSM, f=fvar)

# The complete data is available in package simboot.

# # #
# Simultaneous confidence intervals for ratios of expected values
# under lognormal assumption

x <- rlnorm(n=40, meanlog=rep(c(0,0.1,1,1), each=10), sdlog=rep(c(0.2,0.2,0.5,0.5), each=10))
f <- as.factor(rep(LETTERS[1:4], each=10))

lnrci(x=x, f=f, type="Tukey", method="GPQ", B=10000)

Simultaneous confidence intervals for odds ratios

Description

Approximate simultaneous confidence intervals for (weighted geometric means of) odds ratios are constructed. Estimates are derived from fitting a glm on the logit-link, approximate intervals are constructed on the logit-link, and transformed to original scale.

Usage

binomORci(x, ...)

## Default S3 method:
binomORci(x, n, names = NULL,
 type = "Dunnett", method="GLM", cmat = NULL,
 alternative = "two.sided", conf.level = 0.95,
 dist="MVN", ...)

## S3 method for class 'formula'
binomORci(formula, data,
 type = "Dunnett", method="GLM", cmat = NULL,
 alternative = "two.sided", conf.level = 0.95,
 dist="MVN", ...)

## S3 method for class 'table'
binomORci(x,
 type = "Dunnett",method="GLM", cmat = NULL,
 alternative = "two.sided", conf.level = 0.95,
 dist="MVN", ...)

## S3 method for class 'matrix'
binomORci(x,
 type = "Dunnett", method="GLM", cmat = NULL,
 alternative = "two.sided", conf.level = 0.95,
 dist="MVN", ...)

Arguments

x

a numeric vector, giving the number of successes in I independent samples, or an object of class "table", representing the 2xk-table, or an object of class "matrix", representing the 2xk-table

n

numeric vector, giving the number of trials (i.e. the sample size) in each of the I groups (only required if x is a numeric vector, ignored otherwise)

names

an optional character string, giving the names of the groups/ sample in x, n; if not specified the possible names of x are taken as group names (ignored if x is a table or matrix)

formula

a two-sided formula of the style 'response ~ treatment', where 'response' should be a categorical variable with two levels, while treatment should be a factor specifying the treatment levels

data

a data.frame, containing the variables specified in formula

type

a character string, giving the name of a contrast method, as defined in contrMat(multcomp); ignored if cmat is sepcified

method

a single character string, specifying the method for confidence interval computation; Options are "GLM" and "Woolf". "GLM" takes the maximum likelihood estimates and the their standard errors; this yields a conservative confidence intervals with uninformative limits if x=0 and x=n occures. "Woolf" adds 0.5 to the cell counts, resulting in less conservative bounds. These can be liberal when extreme proportions are compared.

cmat

a optional contrast matrix

alternative

a single character string, one of "two.sided", "less", "greater"

conf.level

a single numeric value, simultaneous confidence level

dist

a character string, "MVN" invokes multiplicity adjustment via the multivariate normal distribution, "N" invokes use of quantiles of the univariate normal distribution

...

arguments to be passed to binomest, currently only success labelling the event which should be considered as success

Details

This function calls glm and fits a one-way-model with family binomial on the logit-link. Then, the point estimates and variances estimates from the fit are taken to construct simultaneous confidence intervals for differences (of weighted arithmetic means) of log-odds. Applying the exponential function to these intervals on the logit scale yields intervals for ratios (of weighted geometric) of odds. For simple groupwise comparisons, one yields intervals for oddsratios. For the case of Dunnett-type contrasts, the calculated simultaneous confidence intervals are those described in Holford et al. (1989).

Specifying method="GLM" takes maximum likelihood estimates for the log-odds and their standard errors evaluated at the estimate.

Specifying method="Woolf" takes adds 0.5 to each cell count and computes point estimates and standard errors for these continuity corrected values. For the two-sample comparison this method is refered to as "adjusted Woolf" (Lawson, 2005). In this implementation, the lower bounds yielded by this method are additionally expanded to 0, if all values in the denominator are x=n or all values in the numerator are x=0, and the upper bounds are expanded to Inf, if all values in the denominator are x=0 or all values in the numerator are x=n.

Note, that for the case of general contrasts, the methods are not described explicitly so far.

Value

A object of class "binomORci", a list containing:

conf.int

a matrix with 2 columns: lower and upper confidence bounds, and M rows

alternative

character string, as input

conf.level

single numeric value, as input

estimate

a matrix with 1 column: containing the estimates of the contrasts

x

the observed number of successes

n

the number of trials

p

the estimated proportions

success

a character string labelling the event considered as success

names

the group names

method

a character string, specifying the method of interval construction

cmat

the contrast matrix used

Author(s)

Frank Schaarschmidt, Daniel Gerhard

References

Holford, TR, Walter, SD and Dunnett, CW (1989). Simultaneous interval estimates of the odds ratio in studies with two or more comparisons. Journal of Clinical Epidemiology 42, 427-434.

See Also

Intervals for the risk difference binomRDci, summary for odds ratio confidence intervals summary.binomORci plot for confidence intervals plot.sci

Examples

data(liarozole)

table(liarozole)

# Comparison to the control group "Placebo",
# which is the fourth group in alpha-numeric
# order:

ORlia<-binomORci(Improved ~ Treatment,
 data=liarozole, success="y", type="Dunnett", base=4)
ORlia
summary(ORlia)
plot(ORlia)

# if data are available as table:

tab<-table(liarozole)
tab
ORlia2<-binomORci(tab, success="y", type="Dunnett", base=4)
ORlia2

plot(ORlia2, lines=1, lineslty=3)


############################

#  Performance for extreme cases

# method="GLM" (the default)

test1<-binomORci(x=c(0,1,5,20), n=c(20,20,20,20), names=c("A","B","C","D"))
test1
plot(test1)

# adjusted Woolf interval

test2<-binomORci(x=c(0,1,5,20), n=c(20,20,20,20), names=c("A","B","C","D"), method="Woolf")
test2
plot(test2)

Simultaneous confidence intervals for contrasts of independent binomial proportions (in a oneway layout)

Description

Simultaneous asymptotic CI for contrasts of binomial proportions, assuming that standard normal approximation holds. The contrasts can be interpreted as differences of (weighted averages) of proportions (risk ratios).

Usage

binomRDci(x,...)

## Default S3 method:
binomRDci(x, n, names=NULL,
 type="Dunnett", cmat=NULL, method="Wald",
 alternative="two.sided", conf.level=0.95,
 dist="MVN", ...)

## S3 method for class 'formula'
binomRDci(formula, data,
 type="Dunnett", cmat=NULL, method="Wald",
 alternative="two.sided", conf.level=0.95,
 dist="MVN",...)

## S3 method for class 'table'
binomRDci(x, type="Dunnett",
 cmat=NULL, method="Wald", alternative="two.sided",
 conf.level=0.95, dist="MVN",...)

## S3 method for class 'matrix'
binomRDci(x, type="Dunnett",
 cmat=NULL, method="Wald", alternative="two.sided",
 conf.level=0.95, dist="MVN",...)

Arguments

x

a numeric vector, giving the number of successes in I independent samples, or an object of class "table", representing the 2xk-table, or an object of class "matrix", representing the 2xk-table

n

a numeric vector, giving the number of trials (i.e. the sample size) in each of the I groups (only required if x is a numeric vector, ignored otherwise)

names

an optional character string, giving the names of the groups/ sample in x, n; if not specified the possible names of x are taken as group names (ignored if x is a table or matrix)

formula

a two-sided formula of the style 'response ~ treatment', where 'response' should be a categorical variable with two levels, while treatment should be a factor specifying the treatment levels

data

a data.frame, containing the variables specified in formula

type

a character string, giving the name of a contrast method, as defined in contrMat(multcomp); ignored if cmat is specified

cmat

a optional contrast matrix

method

a single character string, specifying the method for confidence interval construction; options are: "Wald", "ADD1", or "ADD2"

alternative

a single character string, one of "two.sided", "less", "greater"

conf.level

a single numeric value, simultaneous confidence level

dist

a character string, "MVN" invokes multiplicity adjustment via the multivariate normal distribution, "N" invokes use of quantiles of the univariate normal distribution

...

arguments to be passed to binomest, currently only success labelling the event which should be considered as success

Details

See the examples for different usages.

Value

A object of class "binomRDci", a list containing:

conf.int

a matrix with 2 columns: lower and upper confidence bounds, and M rows

alternative

character string, as input

conf.level

single numeric value, as input

quantile

the quantile used to construct the confidence intervals

estimate

a matrix with 1 column: containing the estimates of the contrasts

x

the observed number of successes in the treatment groups

n

the number of trials in the treatment groups

p

the estimated proportions in the treatment groups

success

a character string labelling the event considered as success

names

the group names

method

a character string, specifying the method of interval construction

cmat

the contrast matrix used

Note

Note, that all implemented methods are approximate only. The coverage probability of the intervals might seriously deviate from the nominal level for small sample sizes and extreme success probabilities. See the simulation results in Sill (2007) for details.

References

Schaarschmidt, F., Sill, M. and Hothorn, L.A. (2008): Approximate simultaneous confidence intervals for multiple contrasts of binomial proportions. Biometrical Journal 50, 782-792.

Background references:

The ideas underlying the "ADD1" and "ADD2" adjustment are described in:

Agresti, A. and Caffo, B.(2000): Simple and effective confidence intervals for proportions and differences of proportions result from adding two successes and two failures. American Statistician 54, p. 280-288.

And have been generalized for a single contrast of several proportions in:

Price, R.M. and Bonett, D.G. (2004): An improved confidence interval for a linear function of binomial proportions. Computational Statistics and Data Analysis 45, 449-456.

More detailed simulation results are available in:

Sill, M. (2007): Approximate simultaneous confidence intervals for multiple comparisons of binomial proportions. Master thesis, Institute of Biostatistics, Leibniz University Hannover.

See Also

summary.binomRDci, plot.sci

Examples

###############################################################

### Example 1 Tables 1,7,8 in Schaarschmidt et al. (2008):  ###

###############################################################

# Number of patients under observation: 
n <- c(29, 24, 25, 24, 46)

# Number of patients with complete response:
cr <- c(7, 11, 10, 12, 21)

# (Optional) names for the treatments
dn <- c("0.3_1.0", "3", "10", "30", "90")

# Assume we aim to infer an increasing trend with increasing dosage,
# Using the changepoint contrasts (Table 7, Schaarschmidt et al., 2008)

# The results in Table 8 can be reproduced by calling:

binomRDci(n=n, x=cr, names=dn, alternative="greater",
 method="ADD2", type="Changepoint")

binomRDci(n=n, x=cr, names=dn, alternative="greater",
 method="ADD1", type="Changepoint")

binomRDci(n=n, x=cr, names=dn, alternative="greater", 
 method="Wald", type="Changepoint")

##############################################################

### Example 2, Tables 2,9,10 in Schaarschmidt et al. 2008  ###

##############################################################

# Data (Table 2)

# animals under risk
n<-c(30,30,30,30)

# animals showing cancer
cancer<-c(20,14,27,19)

# short names for the treatments
trtn<-c("HFaFi","LFaFi","HFaNFi","LFaNFi")


# User-defined contrast matrix (Table 9),
# columns of the contrast matrix 

cmat<-rbind(
"Fiber - No Fiber"=c( 0.5, 0.5,-0.5,-0.5),
"Low Fat - High Fat"=c(-0.5, 0.5,-0.5, 0.5),
"Interaction Fat:Fiber"=c(   1,  -1,   -1,  1))

cmat

# The results in Table 10 can be reproduced by calling:

# simultaneous CI using the add-2 adjustment

sci<-binomRDci(x=cancer, n=n, names=trtn, method="ADD2",
 cmat=cmat, dist="MVN")

sci

# marginal CI using the basic Wald formula

ci<-binomRDci(x=cancer, n=n, names=trtn, method="Wald",
 cmat=cmat, dist="N")

ci


# check, whether the intended contrasts have been defined:

summary(sci)

# plot the result:

plot(sci, lines=0, lineslty=3)


##########################################


# In simple cases, counts of successes
# and number of trials can be just typed:

ntrials <- c(40,20,20,20)
xsuccesses <- c(1,2,2,4)
names(xsuccesses) <- LETTERS[1:4]
ex1D<-binomRDci(x=xsuccesses, n=ntrials, method="ADD1",
 type="Dunnett")
ex1D

ex1W<-binomRDci(x=xsuccesses, n=ntrials, method="ADD1",
 type="Williams", alternative="greater")
ex1W

# results can be plotted:
plot(ex1D, main="Comparisons to control group A", lines=0, linescol="red", lineslwd=2)

# summary gives a more detailed print out:
summary(ex1W)

# if data are represented as dichotomous variable
# in a data.frame one can make use of table:


#################################

data(liarozole)

head(liarozole)

binomRDci(Improved ~ Treatment, data=liarozole,
 type="Tukey")

# here, it might be important to define which level of the
# variable 'Improved' is to be considered as success

binomRDci(Improved ~ Treatment, data=liarozole,
 type="Dunnett", success="y", base=4)

# If data are available as a named kx2-contigency table:

tab<-table(liarozole)
tab

# Comparison to the control group "Placebo",
# which is the fourth group in alpha-numeric order:

CIs<-binomRDci(tab, type="Dunnett", success="y", base=4)

plot(CIs, lines=0)

Simultaneous test for contrasts of independent binomial proportions (in a oneway layout)

Description

P-value of maximum test and adjusted p-values for M contrasts of I groups in a one-way layout. Tests are performed for contrasts of proportions, which can be interpreted as differences of (weighted averages of) proportions.

Usage

binomRDtest(x, ...)

## Default S3 method:
binomRDtest(x, n, names=NULL,
 type="Dunnett", cmat=NULL, method="Wald",
 alternative="two.sided", dist="MVN", ...)

## S3 method for class 'formula'
binomRDtest(formula, data,
 type="Dunnett", cmat=NULL, method="Wald",
 alternative="two.sided", dist="MVN", ...)

## S3 method for class 'table'
binomRDtest(x, type="Dunnett",
 cmat=NULL, method="Wald", alternative="two.sided",
 dist="MVN", ...)

## S3 method for class 'matrix'
binomRDtest(x, type="Dunnett",
 cmat=NULL, method="Wald", alternative="two.sided",
 dist="MVN", ...)

Arguments

x

a numeric vector, giving the number of successes in I independent samples, or an object of class "table", representing the 2xk-table, or an object of class "matrix", representing the 2xk-table

n

a numerioc vector, giving the number of trials (i.e. the sample size) in each of the I groups

names

an optional character vector, giving the names of the groups in x, n; if not specified, possibly availbale names of x are taken as group names

formula

a two-sided formula of the style 'response ~ treatment', where 'response' should be a categorical variable with two levels, while treatment should be a factor specifying the treatment levels

data

a data.frame, containing the variables specified in formula

type

a character string specifying the contrast type

cmat

an optional user defined contrast matrix of dimension MxI

method

a single charcter string, specifying the method for adjustment, with options: "Wald" (Maximum likelihood estimators), "ADD1" (add1-adjustment on the raw proportion estimates) "ADD2" (add2-adjustment on proportion estimates following Agresti Caffo (2000))

alternative

a character string specifying the direction of the alternative hypothesis

dist

a character string, where "MVN" invokes the computation of p-values using the multivariate normal distribution, and "N" invokes use p-value computation using the univariate normal distribution

...

arguments to be passed to binomest, currently only success labelling the event which should be considered as success

Details

For usage, see the examples.

Value

An object of class "binomRDtest", a list containing:

teststat

a numeric vector of teststatistics of length M

pval

a single numeric p-value, the p-value of the maximum test (minimum p-value)

p.val.adj

a vector of length M, the adjusted p-values of the single contrasts

dist

character string indicating whether the multivariate normal or normal distribution was used for computation of p-values

alternative

a single character vector, as the input

x

the observed number of successes in the treatment groups

n

the number of trials in the treatment groups

p

the estimated proportions in the treatment groups

success

a character string labelling the event considered as success

method

as input, a character string

cmat

used contrast matrix

Note

Note, that all implemented methods are approximate only. The size of the test might seriously deviate from the nominal level for small sample sizes and extreme success probabilities. See the simulation results in Sill (2007) for details.

References

Statistical procedures and characterization of coverage probabilities are described in: Sill, M. (2007): Approximate simultaneous confidence intervals for multiple comparisons of binomial proportions. Master thesis, Institute of Biostatistics, Leibniz University Hannover.

See Also

summary.binomRDtest

Examples

ntrials <- c(40,20,20,20)
xsuccesses <- c(1,2,2,4)
names(xsuccesses) <- LETTERS[1:4]
binomRDtest(x=xsuccesses, n=ntrials, method="ADD1",
 type="Dunnett")

binomRDtest(x=xsuccesses, n=ntrials, method="ADD1",
 type="Williams", alternative="greater")

binomRDtest(x=xsuccesses, n=ntrials, method="ADD2",
 type="Williams", alternative="greater")

Simultaneous confidence intervals for ratios of independent binomial proportions

Description

Simultaneous asymptotic CI for contrasts of binomial proportions, assuming that standard normal approximation holds on the log scale. Confidence intervals for ratios of (weighted geometric means) of proportions are calculated based on differences of log-proportions, and normal approximation on the log-scale.

Usage

binomRRci(x,...)

## Default S3 method:
binomRRci(x, n, names=NULL,
 type="Dunnett", cmat=NULL,
 alternative="two.sided", conf.level=0.95,
 dist="MVN", ...)

## S3 method for class 'formula'
binomRRci(formula, data,
 type="Dunnett", cmat=NULL,
 alternative="two.sided", conf.level=0.95,
 dist="MVN",...)

## S3 method for class 'table'
binomRRci(x, type="Dunnett",
 cmat=NULL, alternative="two.sided",
 conf.level=0.95, dist="MVN",...)

## S3 method for class 'matrix'
binomRRci(x, type="Dunnett",
 cmat=NULL, alternative="two.sided",
 conf.level=0.95, dist="MVN",...)

Arguments

x

a numeric vector, giving the number of successes in I independent samples, or an object of class "table", representing the 2xk-table, or an object of class "matrix", representing the 2xk-table

n

a numeric vector, giving the number of trials (i.e. the sample size) in each of the I groups (only required if x is a numeric vector, ignored otherwise)

names

an optional character string, giving the names of the groups/ sample in x, n; if not specified the possible names of x are taken as group names (ignored if x is a table or matrix)

formula

a two-sided formula of the style 'response ~ treatment', where 'response' should be a categorical variable with two levels, while treatment should be a factor specifying the treatment levels

data

a data.frame, containing the variables specified in formula

type

a character string, giving the name of a contrast method, as defined in contrMat(multcomp); ignored if cmat is specified

cmat

a optional contrast matrix

alternative

a single character string, one of "two.sided", "less", "greater"

conf.level

a single numeric value, simultaneous confidence level

dist

a character string, "MVN" invokes multiplicity adjustment via the multivariate normal distribution, "N" invokes use of quantiles of the univariate normal distribution

...

arguments to be passed to binomest, currently only success labelling the event which should be considered as success

Details

The interval for the ratio of two independent proportions, described in section "Crude Methods using first-order variance estimation" in Gart and Nam (1988) are extended to multiple contrasts. Confidence intervals are constructed based on contrasts for differences of lp=log (x+0.5)/(n+0.5), using quantiles of the multivariate normal or normal approximation. Applying the exponential functions to the bounds results in intervals for the risk ratio. In case that 0 occur in both, the numerator and denominator of the ratio, the interval is expanded to [0,Inf], in case that only 0s numerator go to the numerator, the lower bound is expanded to 0, in case that only 0s go to the denominator, the upper bound is expanded to Inf.

See the examples for different usages.

Value

A object of class "binomRDci", a list containing:

conf.int

a matrix with 2 columns: lower and upper confidence bounds, and M rows

alternative

character string, as input

conf.level

single numeric value, as input

quantile

the quantile used to construct the confidence intervals

estimate

a matrix with 1 column: containing the estimates of the contrasts

x

the observed number of successes in the treatment groups

n

the number of trials in the treatment groups

p

the estimated proportions in the treatment groups

success

a character string labelling the event considered as success

names

the group names

method

a character string, specifying the method of interval construction

cmat

the contrast matrix used

Note

Note, that all implemented methods are approximate only. The coverage probability of the intervals might seriously deviate from the nominal level for small sample sizes and extreme success probabilities.

References

Gart, JJ and Nam,J-m (1988): Approximate interval estimation of the ratio of binomial parameters: a review and corrections for skewness. Biometrics 44, 323-338.

See Also

summary.binomRDci for the risk difference, summary.binomORci for the odds ratio, plot.sci for plotting

Examples

# In simple cases, counts of successes
# and number of trials can be just typed:

ntrials <- c(40,20,20,20)
xsuccesses <- c(1,2,2,4)
names(xsuccesses) <- LETTERS[1:4]
ex1D<-binomRRci(x=xsuccesses, n=ntrials,
 type="Dunnett")
ex1D

ex1W<-binomRRci(x=xsuccesses, n=ntrials,
 type="Williams", alternative="greater")
ex1W

# results can be plotted:
plot(ex1D, main="Comparisons to control group A")

# summary gives a more detailed print out:
summary(ex1W)

# if data are represented as dichotomous variable
# in a data.frame one can make use of table:


data(liarozole)

head(liarozole)

# here, it might be important to define which level of the
# variable 'Improved' is to be considered as success

binomRRci(Improved ~ Treatment, data=liarozole,
 type="Dunnett", success="y", base=4, alternative="greater")

# If data are available as a named kx2-contigency table:

tab<-table(liarozole)
tab

binomRRci(tab, type="Dunnett", success="y", base=4, alternative="greater")


# Performance for extreme cases:


binomRRci(x=c(0,0,20,5),n=c(20,20,20,20),names=c("A","B","C","D"),
 type="Dunnett", alternative="greater")

Rodent bronchial carcinoma data

Description

In a long term rodent carcinogenicity study on female B6C3F1 mice, the effect of vinylcyclohexene diepoxide on the incidence of murine alveolar/bronchiolar tumors was assessed. The mice were exposed to 0 mg/ml, (group 0), 25 mg/ml (group 1), 50 mg/ml (group 2), and 100 (group 3) mg/ml, with 50 animals per group.

Usage

data(bronch)

Format

A data frame with 200 observations on the following 3 variables.

group

a factor with levels 0, 1, 2, 3, labelling the control and the three dose groups

Y

a logical vector, indicating whether a tumour was present at time of death (if TRUE), or not (if FALSE)

time

a numeric vector, the time of death, counted in days? from begin of the study

Details

Not yet checked for consistency with the source!

Source

Piegorsch WW and Bailer AJ (1997): Statistics for environmental biology and toxicology. Chapman and Hall, London. Table 6.5, page 238.

References

Portier cJ and Bailer AJ (1989): Testing for increased carcinogenicity using survival-adjusted quantal response tests. Fundamental and Applied Toxicology 12, 731.

Examples

data(bronch)
# raw tumour counts:

table(bronch[c("group","Y")])

# groupwise times of death:

boxplot(time ~ group, data=bronch, horizontal=TRUE)

# Using poly3estf, we can produce the
# summary statistics as presented in 
# Table 6.6, page 239, of Piegorsch and Bailer (1997):

poly3estf(status=bronch$Y, time=bronch$time, f=bronch$group)

Random data for Poly-k

Description

Random numbers from two independent Weibull distributions for Mortality and tumour induction.

Usage

censsample(n, scale.m, shape.m,
 scale.t, shape.t = 3, tmax)

Arguments

n

a single numeric value, the number of individuals

scale.m

a single numeric value, scale parameter of the Weibull distribution for mortality

shape.m

a single numeric value, shape parameter of the Weibull distribution for mortality

scale.t

a single numeric value, scale parameter of the Weibull distribution for tumour induction

shape.t

a single numeric value, shape parameter of the Weibull distribution for tumour induction

tmax

a single numeric value, maximum time in the trial

Value

A data.frame with columns

time

a numeric vector of length n, the time of death of an individual

status

a logical vector of length n, the tumour status at time of death (TRUE: tumour present, FALSE: no tumour present)

T.t

time of tumour induction (unobservable)

T.m

time of death

tmax

maximum time of death


Random data for Poly-k

Description

Random data for Poly-k for a one-way layout, with I groups.

Usage

censsamplef(n, scale.m, shape.m, scale.t, shape.t = 3, tmax)

Arguments

n

a numeric vector, the numbers of individuals of length I

scale.m

a numeric vector, scale parameters of the Weibull distribution for mortality

shape.m

a numeric vector, shape parameters of the Weibull distribution for mortality

scale.t

a numeric vector, scale parameters of the Weibull distribution for tumour induction

shape.t

a numeric vector, shape parameters of the Weibull distribution for tumour induction

tmax

a single numeric value, maximum time in the trial

Value

A data.frame with columns

time

a numeric vector of length n, the time of death of an individual

status

a logical vector of length n, the tumour status at time of death (TRUE: tumour present, FALSE: no tumour present)

T.t

time of tumour induction (unobservable)

T.m

time of death

tmax

maximum time of death

f

a factor of containing an appropriate grouping variable


A function to calculate the correlation matrix

Description

Correlation matrix for teststatistics and confidence intervals assuming multivariate standard normal distribution

Usage

corrMatgen(CM, varp)

Arguments

CM

a matrix of contrast coefficients, dimension MxI, where M=number of contrasts, and I=number of groups in a oneway layout

varp

a numeric vector of groupwise variance estimates (length = I)

Value

A matrix of dimension MxM.

References

For correlation of contrasts of binomial proportion, see: Bretz F, Hothorn L.: Detecting dose-response using contrasts: asymptotic power and sample size determination for binomial data. Statistics in Medicine 2002; 21: 3325-3335.


Estimate the Shannon Index

Description

Calculates estimates of the Shannon-Wiener from count data.

Usage

estShannon(x, Nspec = NULL)

Arguments

x

a integer(numeric) vector of species counts

Nspec

a single integer value, fixing the number of species to a certain value

Value

A list, containing the elements:

estimate

a single numeric value, the estimate with bias correction according to Fritsch and Hsu (1999)

estraw

a single numeric value, the raw estimate

varest

a single numeric value, the variance estimate according to Fritsch and Hsu (1999)

References

Fritsch, KS, and Hsu, JC (1999): Multiple Comparison of Entropies with Application to Dinosaur Biodiversity. Biometrics 55, 1300-1305.

See Also

estSimpsonf for estimating Shannon indices pooled over several samples, grouped by a factor


Estimate the Shannon-Wiener index

Description

Calculate estimates of the Shannon-Wiener index after pooling over several samples, grouped by a factor variable.

Usage

estShannonf(X, f)

Arguments

X

a data.frame of dimension n times p with integer entries, where n is the number of samples and p is the number of species

f

a factor variable of length n, grouping the observations in X

Details

The function splits X according to the levels of the grouping variable f, builds the sum over each column and calculates the Shannon index ove the resulting counts.

Value

A list, containing the elements:

estimae

a named numeric vector, the groupwise Shannon indices with bias correction according to Fritsch and Hsu (1999)

estraw

a named numeric vector, the groupwise Shannon indices, without bias correction

varest

a named numeric vector, the groupwise variance estimates of the Shannon indices

table

a matrix, giving the summarized counts of the groups in the rows

References

Fritsch, KS, and Hsu, JC (1999): Multiple Comparison of Entropies with Application to Dinosaur Biodiversity. Biometrics 55, 1300-1305.

Examples

data(HCD)
HCD

# Groupwise point estimates:

est<-estShannonf(X=HCD[,-1], f=HCD[,1])

est

Simpson index

Description

Calculates the estimate of the Simpson index from a vector of counts.

Usage

estSimpson(x)

Arguments

x

a integer (numeric) vector, giving the counts of p species in a community


Estimate the Simpson index from several samples

Description

Calculate estimates of the Simpson index after pooling over several samples, grouped by a factor variable.

Usage

estSimpsonf(X, f)

Arguments

X

a data.frame of dimension n times p with integer entries, where n is the number of samples and p is the number of species

f

a factor variable of length n, grouping the observations in X

Details

The function splits X according to the levels of the grouping variable f, builds the sum over each column and calculates the Shannon index ove the resulting counts.

Value

A list containing the items:

estimate

the groupwise point estimates of the Simpson index

varest

the groupwise variance estimates of the Simpson index

table

a matrix of counts,containing the summed observations for each level of f in its rows

References

Rogers, JA and Hsu, JC (2001): Multiple Comparisons of Biodiversity. Biometrical Journal 43, 617-625.

See Also

estShannonf

Examples

# Here, the estimates for the Hell Creek Dinosaur 
# example are compared to the estimates in 
# Tables 2 and 3 of Rogers and Hsu (2001).

data(HCD)
HCD

# Groupwise point estimates:

est<-estSimpsonf(X=HCD[,-1], f=HCD[,1])

est

# Table 2:


cmat<-rbind(
"lower-middle"=c(1,-1,0),
"lower-upper"=c(1, 0,-1),
"middle-upper"=c(0,1,-1))


# the point estimates:

# cmat %*% est$estimate
crossprod(t(cmat), est$estimate)


# the standard errors:
# sqrt(diag(cmat %*% diag(est$varest) %*% t(cmat)))

sqrt(diag(crossprod(t(cmat), crossprod(diag(est$varest), t(cmat)) ) ))


# Table 3:

cmat<-rbind(
"middle-lower"=c(-1,1,0),
"upper-lower"=c(-1,0,1))

# cmat %*% est$estimate
crossprod(t(cmat), est$estimate)


# sqrt(diag(cmat %*% diag(est$varest) %*% t(cmat)))

sqrt(diag(crossprod(t(cmat), crossprod(diag(est$varest), t(cmat)) ) ))

# Note, that the point estimates are exactly
# the same as in Rogers and Hsu (2001),
# but the variance estimates are not, whenever
# the Upper group is involved.

Hell Creek Dinosaur Data

Description

Counts of dinosaur families found in three stratigraphic levels of the Cretaceous period in the Hell Creek formation in North Dakota. The eight families are the Ceratopsidae (Ce), Hadrosauridae (Ha), Hypsilophodontidae (Hy), Pachycephalosauridae (Pa), Tyrannosauridae (Ty), Ornithomimidae (Or), Sauronithoididae (Sa) and Dromiaeosauridae (Dr).

Usage

data(HCD)

Format

A data frame with 3 observations on the following 9 variables.

Level

a factor with levels Lower, Middle, Upper, specifiyng the stratigraphic levels

Cr

a numeric vector, counts of the Ceratopsidae

Ha

a numeric vector, counts of the Hadrosauridae

Hy

a numeric vector, counts of the Hypsilophodontidae

Pa

a numeric vector, counts of the Pachycephalosauridae

Ty

a numeric vector, counts of the Tyrannosauridae

Or

a numeric vector, counts of the Ornithomimidae

Sa

a numeric vector, counts of the Sauronithoididae

Dr

a numeric vector, counts of the Dromiaeosauridae

Source

Table 1 in: Rogers, JA and Hsu, JC (2001): Multiple Comparisons of Biodiversity. Biometrical Journal 43, 617-625.

References

Sheehan, P.M., et al. (1991): Sudden extinction of the Dinosaurs: Latest Cretaceous, Upper Great Plains, U.S.A. Science 254, 835-839.

Examples

data(HCD)
str(HCD)
HCD

mat<-as.matrix(HCD[,-c(1)])

rownames(mat)<-HCD$Level

mosaicplot(mat, las=1)

estSimpsonf(X=HCD[,-c(1)], f=HCD$Level)

estShannonf(X=HCD[,-c(1)], f=HCD$Level)

Marked improvement of psoriasis after application of liarozole

Description

In a placebo controlled clinical trial, patients with psoriasis were randomly assigned to a placebo group and three dose groups (50 mg, 75 mg, and 150 mg). Variable of primary interest was the proportion of patients with marked improvement of psoriasis. This data.frame mimics how raw data could have been represented in a larger data frame.

Usage

data(liarozole)

Format

A data frame with 137 observations on the following 2 variables.

Improved

a factor with levels n, y, for "no" and "yes"

Treatment

a factor with levels Dose150, Dose50, Dose75, Placebo

Details

For illustrative purpose only. Number of successes recalculated from proportions presented in the publication, while the number of patients in group Dose50 was not exactly clear.

Source

Berth-Jones J, Todd G, Hutchinson PE, Thestrup-Pedersen K, Vanhoutte FP: Treatment of psoriasis with oral liarozole: a dose-ranging study. British Journal of Dermatology 2000; 143: 1170-1176.

Examples

data(liarozole)
head(liarozole)
# create a contingency table:

table(liarozole)


# the order of the groups is alpha-numeric,
# and "y" for success is of higher order than
# to change the order:

liarozole$Treatment<-factor(liarozole$Treatment,
 levels=c("Placebo", "Dose50", "Dose75", "Dose150"))

liarozole$Improved<-factor(liarozole$Improved,
 levels=c("y", "n"))


tab<-table(liarozole)
tab

# Approximate simultaneous confidence intervals
# for the differences  pDose-pPlacebo:

LCI<-binomRDci(tab, type="Dunnett", 
alternative="greater", method="ADD1")

LCI

plot(LCI, main="Proportion of patients
 with marked improvement")

# Perform a test on increasing trend 
# vs. the placebo group:

Ltest<-binomRDtest(tab, type="Williams", 
alternative="greater", method="ADD1")

summary(Ltest)

Simultaneous confidence intervals for expected values assuming lognormal distribution.

Description

Simultaneous confidence intervals for multiple contrasts of expected values of several (K) groups in a one-way layout, assuming lognormal distribution of the response. Multiple ratios of (weighted geometric means of) expected values can be estimated as well as multiple differences of (weighted arithmetic means of) the expected values in the K groups can be estimated. For both, ratios and differences, a method based on asymptotic normality (not recommended) and a method based on generalized pivotal quantities are available.

Usage

lnrci(x, f, type = "Dunnett", cmat = NULL,
 alternative = c("two.sided", "less", "greater"),
 conf.level = 0.95, method = c("GPQ", "AN"), ...)
lndci(x, f, type = "Dunnett", cmat = NULL,
 alternative = c("two.sided", "less", "greater"),
 conf.level = 0.95, method = c("GPQ", "AN"), ...)

Arguments

x

a numeric vector, the response variable, assumed to be lognormally distributed, should contain only positive values

f

a factor variable, of the same length as x, groupingt the observations in x

type

a single character string, naming a contrast type, see contrMat for the options; this argument is ignored if a contrast matrix is specified in cmat

cmat

a matrix with numeric entries, containing contrast coefficients; if there are K levels in f, the matrix should have k columns

alternative

a single character string, with options "two.sided" for two-sided confidence intervals, "less" for upper bounds only and "greater" for lower bounds only

conf.level

a single numeric value between 0 and 1

method

a single character string, naming the method by which to compute the confidence intervals; options are "GPQ" for a method based on generalized pivotal quantities and "AN" for the asymptotic normal method (not recommended).

...

further arguments to be passed to the internal methods, in particular: Argument B specifies the number of samples to be drawn if method "GPQ" (defaults to 10000), it is ignored if method="AN". Second, dist must be a single character string as in Waldci, invoking the use of multivariate normal quantiles dist="MVN" or standard normal quantiles dist="N" when method="AN"; it is ignored if method="GPQ".

Details

In a setting with K treatment groups, assuming a completely randomized design and lognormal distribution of the response variable, multiple (M) ratios or differences among expected values of the K treatment groups may be of interest. The ratios or differences of interest can be specified via a character string (in argument type) or via an M x K matrix in argument cmat. Intervals for ratios can be computed (via linear contrasts on the log scale) in function lnrci, differences can be computed in fucntion lndci. A simulation study of the methods implemented here can be found in Schaarschmidt (2013).

By default, the confidence intervals are adjusted for multiple comparisons. The asymptotic normal methods, rely on maximum likelihood estimates for the expected values and the corresponding variance estimates (as given in Chen and Zhou, 2006) and adjut for multiplicity via critical value from the multivariate normal distribution (correlation structure with plug-in of variance estimates). The generalized pivotal quantity methods rely on simulating the distribution of the parameters (number of samples B=10000 by default, Krishnamoorthy and Mathew, 2003; Chen and Zhou, 2006) and compute simultaneous intervals from this sample using the function SCSrank.

Value

A list with elements

estimate

a column vector, containing the point estimates of the contrasts

conf.int

a Mx2 matrix of confidence bounds, if M comparisons among the K samples are invoked

alternative

a character string, as input

conf.level

a numeric value, as input

Author(s)

Frank Schaarschmidt

References

Schaarschmidt, F. (2013). Simultaneous confidence intervals for multiple comparisons among expected values of log-normal variables. Computational Statistics and Data Analysis 58, 265-275

Chen, Y-H, Zhou, X-H (2006). Interval estimates for the ratio and the difference of two log-normal means. Statistics in Medicine 25, 4099-4113.

Krishnamoorthy K, Mathew T (2003). Inferences on the means of lognormal distributions using generalized p-values and generalized confidence intervals. Journal of Statistical Planning and Inference 115, 103-121.

Examples

x <- rlnorm(n=100, meanlog=rep(c(0,0.1,1,1), each=25), sdlog=0.5)
f <- as.factor(rep(LETTERS[1:4], each=25))
boxplot(x~f)

lndci(x=x, f=f, type="Dunnett", method="GPQ", B=20000)
lndci(x=x, f=f, type="Dunnett", method="AN")

lnrci(x=x, f=f, type="Tukey", method="GPQ", B=20000)
lnrci(x=x, f=f, type="Tukey", method="AN")

NTP bioassay data: effect of methyleugenol on skin fibroma

Description

NTP bioassay of methyleugenol: 200 male rats were randomly assigned to 4 treatment groups with balanced sample size 50. Individuals in treatment group 0, 1, 2, and 3 received doses of 0, 37, 75, and 150 mg methyleugenol per kg body weight, respectively. The response variable tumour is the presence of skin fibroma at time of death. The variable death gives individual time of death, with a final sacrifice of surviving animals at 730 days after begin of the assay.

Usage

data(methyl)

Format

A data frame with 200 observations on the following 3 variables.

group

a factor with levels 0, 1, 2, 3, specifying dose groups 0, 37, 75, and 150 mg/kg, respectively

tumour

a numeric vector, specifying whether a tumour was present at time of death

death

a numeric vector, specifying the time of death

Source

National toxicology program (2000).

References

SD Peddada, GE Dinse, JK Haseman (2005): A survival-adjusted quantal response test for comparing tumour incidence rates. Applied Statistics 54, 51-61.

Examples

data(methyl)
# raw tumour proportions:
table(methyl[c("group", "tumour")])

# time of death:
boxplot(death~group, data=methyl, horizontal=TRUE)

Mosaicplot for the data in Shannonci and Simpsonci

Description

Create a mosaicplot from objects of class Shannonci or Simpsonci

Usage

mosaicdiv(x, decreasing = NULL, ...)

Arguments

x

an object of class "Simpsonci" or "Shannonci" as can be obtained from calling Simpsonci or Shannonci

decreasing

a single logical value, indicating whether the species should be plotted in the current order (if decreasing=NULL), in decreasing order (if decreasing=TRUE), or in increasing order (if decreasing=FALSE)

...

further arguments to be passed to mosaicplot, see ?mosaicplot and ?par for details

Details

This function uses the counts in [["sample.estimate"]][["table"]] to produce a mosaicplot.

Value

A plot.

Examples

data(HCD)

HCDFam <- HCD[,-1]

SCI<-Simpsonci(X=HCDFam, f=HCD[,1])

mosaicdiv(SCI, decreasing=TRUE, col=rainbow(n=8))

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.

Details

Testversion.

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)

Author(s)

Frank Schaarschmidt

See Also

as.data.frame.multinomORci, print.multinomORci

Examples

# 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)

## End(Not run)

Plot confidence intervals

Description

Function for convenient plotting of confidence intervals.

Usage

## S3 method for class 'sci'
plot(x, ...)
## S3 method for class 'binomRDci'
plot(x, ...)
## S3 method for class 'binomORci'
plot(x, ...)
## S3 method for class 'binomRRci'
plot(x, ...)
## S3 method for class 'poly3ci'
plot(x, ...)
## S3 method for class 'Shannonci'
plot(x, ...)
## S3 method for class 'Simpsonci'
plot(x, ...)

Arguments

x

an object of class "binomRDci", "binomORci", "binomRRci", "poly3ci", "sci"

...

further arguments as described in plotCI

Details

Extracts some values and calls plotCI.

Value

A plot.


Plot confidence intervals

Description

A function for convenient plotting of confidence intervals.

Usage

## Default S3 method:
plotCI(x, ...)
## S3 method for class 'sci'
plotCI(x, ...)
## S3 method for class 'sci.ratio'
plotCI(x, ...)
## S3 method for class 'confint.glht'
plotCI(x, ...)

Arguments

x

An object of class "sci", "sci.ratio" or "conf.int.glht" or a list with elements estimate, containing a numeric vector,conf.int, containing a matrix with two columns, giving the lower and upper bounds, and a string alternative, one of "two.sided", "less", "greater"

...

additional arguments to be passed to plotCII and plot, see plotCII for details

Details

Plots the estimates, upper and lower limits using points and segments. The names of estimate are passed as labels of the confidence intervals. If infinite bounds occur, the plot region is limited by the most extreme non infinite bound or estimate.

Value

A plot.

See Also

Internally, the function plotCII is used.

Examples

x=c(8,9,9,18,39,44)
n=c(2000,2000,2000,2000,2000,2000)

x<-binomORci(x=x, n=n, names=c("0","120","240","480","600","720"))

plotCI(x, lines=1)

Plot confidence intervals

Description

A function for convenient plotting of confidence intervals.

Usage

plotCII(estimate, lower = NULL, upper = NULL,
 alternative = c("two.sided", "less", "greater"),
 lines = NULL, lineslty = 2, lineslwd = 1, 
 linescol = "black", CIvert = FALSE, CIlty = 1,
 CIlwd = 1, CIcex = 1, CIcol = "black", CIlength=NULL,
 HL = TRUE, ...)

Arguments

estimate

a (named) numeric vector, the names of the elements are taken as labels of the CI

lower

an optional numeric vector, of the same length as estimate

upper

an optional numeric vector, of the same length as estimate

alternative

a single character string, one of "two.sided", "less", "greater"

lines

an optional numeric (vector) giving the position(s) of line(s) to draw into the plots orthogonal to the confidence intervals

lineslty

possible a vector of line type of the lines, see the options for lty in par

lineslwd

possible a vector of line width of the lines, see the options for lwd in par

linescol

possible a vector of line colors of the lines

CIvert

logical indicating, whether confidence intervals shall be drawn horizontal (default), or vertical (if set to TRUE)

CIlty

single value, to specify the line type used for the CI, see options for lty in ?par

CIlwd

single value, to specify the width type used for the CI, see options for lty in ?par

CIcex

single value, to specify the extension of sympols in the plot, see options for cex in ?par

CIcol

single value, to specify the color used for the CI

CIlength

single numeric value, to be passed to the argument length in function arrows; to specify the lengths of the CI bounds (in inches); defaults to 0.08 and 0.05 for less than 25 and more than 25 CIs, respectively

HL

a logical, if TRUE (default), plot margins of the are adjusted depending on the length of the names by appropriate calls to par; this might be incompatible with combining the plot with others in the same device. If set to FALSE, its up to the user to choose appropriate plot margins by calling to par.

...

further arguments to be passed to plot

See Also

plotCI, for more convenient methods

Examples

est<-c(1,2,3)
names(est)<-c("A", "B", "C")
lw=c(0,1,2)
up=c(2,3,4)

plotCII(estimate=est, lower=lw, upper=up)


plotCII(estimate=est, lower=lw, upper=up,
lines=c(-1,0,1),
lineslty=c(3,1,3),
lineslwd=c(1,2,1))

###########

names(est)<-c("very long names",
 "e v e n  l o n g e r  n a m e s", "C")

plotCII(estimate=est, lower=lw, upper=up,
 CIcol=c("black","green","red"),
 HL=TRUE
)

###########


names(est)<-c("very long names", 
 "e v e n  l o n g e r  n a m e s", "C")

plotCII(estimate=est, lower=lw, upper=up,
 CIcol=c("black","green","red"),
 HL=TRUE
)

op<-par(no.readonly = TRUE)

layout(matrix(1:2, ncol=1))

par(mar=c(5,14,3,1))

plotCII(estimate=est, lower=lw, upper=up,
 main="Lala 1",
 CIcol=c("black","green","red"),
 lines=-1,
 HL=FALSE
)


plotCII(estimate=est, lower=lw, upper=up,
 main="Lala 2",
 CIcol=c("black","green","red"),
 lines=c(0,1),
 HL=FALSE
)

par(op)

Simultaneous confidence intervals for contrasts of poly-3-adjusted tumour rates

Description

Function to calculate simultaneous confidence intervals for several contrasts of poly-3-adjusted tumour rates in a oneway layout. Assuming a data situation as in Peddada(2005) or Bailer and Portier (1988). Simultaneous asymptotic CI for contrasts of tumour rates, assuming that standard normal approximation holds.

Usage

poly3ci(time, status, f, type = "Dunnett",
 cmat = NULL, method = "BP", alternative = "two.sided",
 conf.level = 0.95, dist="MVN", k=3, ...)

Arguments

time

a numeric vector of times of death of the individuals

status

a logical (or numeric, consisting of 0,1 only) vector giving the tumour status at time of death of each individual, where TRUE (1) = tumour present, FALSE (0) = no tumour present

f

a factor, giving the classification variable

type

a character string, giving the name of a contrast method, as defined in contrMat(multcomp)

cmat

a optional contrast matrix

method

a single charcter string, specifying the method for adjustment, with options: "BP" (Bailer Portier: assuming poly-3-adjusted rates are binomial variables), "BW" (Bieler, Williams: delta method as in Bieler and Williams (1993)) "ADD1" (as Bailer Portier, including an add1-adjustment on the raw tumour rates) "ADD2" (as Bailer Portier, including an add2-adjustment on the raw tumour rates following Agresti and Caffo (2000) for binomials)

alternative

a single character string

conf.level

a single numeric value, simultaneous confidence level

dist

a character string, "MVN" invokes multiplicity adjustment via the multivariate normal distribution, "N" invokes use of quantiles of the univariate normal distribution

k

the exponent to calculate survival adjusted proportions, default is k=3

...

further arguments to be passed; currently only base, to be passed to contrMat to choose the control group with type="Dunnett"

Value

A object of class "poly3ci", a list containing:

conf.int

a matrix with 2 columns: lower and upper confidence bounds, and M rows

alternative

character string, as input

conf.level

single numeric value, as input

quantile

the quantile used to construct the CIs

estimate

a numeric vector with the point estimates of the contrasts

time

as input

status

as input

f

as input

method

as input

cmat

as input, with colnames= factor levels of f

sample.est

a list containing sample estimates

Note

Please note that all methods here described are only approximative, and might violate the nominal level in certain situations. Please note further that appropriateness of the point estimates, and consequently of tests and confidence intervals is based on the assumptions in Bailer and Portier (1988), which might be a matter of controversies.

Author(s)

Frank Schaarschmidt

References

The implemented methodology is described in:

Schaarschmidt, F., Sill, M., and Hothorn, L.A. (2008): Approximate Simultaneous confidence intervals for multiple contrasts of binomial proportions. Biometrical Journal 50, 782-792.

Background references are:

Assumption for poly-3-adjustment: Bailer, J.A. and Portier, C.J. (1988): Effects of treatment-induced mortality and tumor-induced mortality on tests for carcinogenicity in small samples. Biometrics 44, 417-431.

Peddada, S.D., Dinse, G.E., and Haseman, J.K. (2005): A survival-adjusted quantal response test for comparing tumor incidence rates. Applied Statistics 54, 51-61.

Bieler, G.S. and Williams, R.L. (1993): Ratio estimates, the Delta Method, and quantal response tests for increased carcinogenicity. Biometrics 49, 793-801.

Statistical procedures and characterization of the coverage probabilities are described in: Sill, M. (2007): Approximate simultaneous confidence intervals for multiple comparisons of binomial proportions. Master thesis, Institute of Biostatistics, Leibniz University Hannover.

Examples

#############################################################

### Methyleugenol example in Schaarschmidt et al. (2008) ####

#############################################################

# load the data:

data(methyl)

# The results in Table 5 (Schaarschmidt et al. 2008) can be
# reproduced by calling:


methylW<-poly3ci(time=methyl$death, status=methyl$tumour,
 f=methyl$group, type = "Williams", method = "ADD1", alternative="greater" )

methylW


methylWT<-poly3test(time=methyl$death, status=methyl$tumour,
 f=methyl$group, type = "Williams", method = "ADD1", alternative="greater" )

methylWT


plot(methylW, main="Simultaneous CI for \n Poly-3-adjusted tumour rates")

# The results in Table 6 can be reproduced by calling:

methylD<-poly3ci(time=methyl$death, status=methyl$tumour,
 f=methyl$group, type = "Dunnett", method = "ADD1", alternative="greater" )

methylD

methylDT<-poly3test(time=methyl$death, status=methyl$tumour,
 f=methyl$group, type = "Dunnett", method = "ADD1", alternative="greater" )

methylDT


plot(methylD, main="Simultaneous CI for Poly-3-adjusted tumour rates", cex.main=0.7)


############################################################


# unadjusted CI

methylD1<-poly3ci(time=methyl$death, status=methyl$tumour,
 f=methyl$group, type = "Dunnett", method = "ADD1", dist="N" )

methylD1

plot(methylD1, main="Local CI for Poly-3-adjusted tumour rates")

Only for internal use.

Description

Poly-3- adjusted point and variance estimates for long term carcinogenicity data

Usage

poly3est(time, status, tmax, method = "BP", k=NULL)

Arguments

time

a numeric vector of times of death of the individuals

status

a logical (or numeric, consisting of 0,1 only) vector giving the tumour status at time of death of each individual, where TRUE (1) = tumour present, FALSE (0) = no tumour present

tmax

a single numeric vector, the final time of the trial

method

a single charcter string, specifying the method for adjustment, with options: "BP" (Bailer Portier: assuming poly-3-adjusted rates are binomial variables), "BW" (Bieler, Williams: delta method as in Bieler-Williams (1993)) "ADD1" (as Bailer Portier, including an add1-adjustment on the raw tumour rates) "ADD2" (as Bailer Portier, including an add2-adjustment on the raw tumour rates following Agresti Caffo (2000) for binomials)

k

a single numeric value, the exponent to calculate survival adjusted proportions according to Bailer and Portier (1988), defaults to 3

Details

Only for internal use of poly3test and poly3ci.

Value

A list containing:

Y

number of tumours

n

number of individuals

estimate

poly-3-adjusted rates according to Bailer, Portier (1988)

weight

a vector of poly-3-adjusted weights, of length n

estp

poly-3-adjusted rate (according to method)

nadj

adjusted n (sum of weights)

varp

variance estimate (according to method)

varcor

variance estimate, if necessary corrected such that estimates of 0 can not occur

Note

Please note, that appropriateness of the point estimates seriously depends on whether the assumptions in Bailer and Portier are met or not.

References

Bailer, J.A. and Portier, C.J. (1988): Effects of treatment-induced mortality and tumor-induced mortality on tests for carcinogenicity in small samples. Biometrics 44, 417-431.


Only for internal use.

Description

Poly-3- adjusted point and variance estimates for long term carcinogenicity data if data are given as a numeric time vector, a logical status vector and a factor containing a grouping variable

Usage

poly3estf(time, status, tmax=NULL, f, method = "BP", k=NULL)

Arguments

time

a numeric vector of times of death of the individuals

status

a logical (or numeric, consisting of 0,1 only) vector giving the tumour status at time of death of each individual, where TRUE (1) = tumour present, FALSE (0) = no tumour present

tmax

a single numeric value, the time of sacrifice in the trial, or the last last time of death, defaults to the maximal value observed in time

f

a factor of the same length as time, status, giving the levels of a grouping variable in a one-way layout

method

a single charcter string, specifying the method for adjustment, with options: "BP" (Bailer Portier: assuming poly-3-adjusted rates are binomial variables), "BW" (Bieler, Williams: delta method as in Bieler-Williams (1993)) "ADD1" (as Bailer Portier, including an add1-adjustment on the raw tumour rates) "ADD2" (as Bailer Portier, including an add2-adjustment on the raw tumour rates following Agresti Caffo (2000) for binomials)

k

a single numeric value, the exponent to calculate survival adjusted proportions according to Bailer and Portier (1988), defaults to 3

Details

For internal use.

Value

A list containing:

Y

a numeric vector, groupwise number of tumours

n

a numeric vector, groupwise number of individuals

estimate

a numeric vector, groupwise poly-3-adjusted rates according to Bailer, Portier (1988)

weight

a numeric vector of poly-3-adjusted weights

estp

a numeric vector, groupwise poly-3-adjusted rate (according to method)

nadj

adjusted n (sum of weights)

varp

a numeric vector, groupwise variance estimate (according to method)

varcor

a numeric vector, groupwise variance estimate, if necessary corrected such that estimates of 0 can not occur

names

a character vector, the levels of the grouping variable f

k

a single numeric value, as input

Note

See poly3est

References

See poly3est

Examples

data(bronch)

poly3estf(status=bronch$Y, time=bronch$time, f=bronch$group, k=3)

poly3estf(status=bronch$Y, time=bronch$time, f=bronch$group, k=5)

Summarize long term carcinogenicity data

Description

Function to summarize data of long term carcinogenicity trials in a text format. Data are assumed to consist of (1) a dichotomous variable, defining whether the tumour of interest was present in an individual animal at time of death, and (2) a numeric variable containing the time of death of an individual animal, and (3) a grouping factor.

Usage

poly3table(time, status, f, tumour = NULL, symbol = "*")

Arguments

time

a numeric vector, containing the time of death of an individual

status

a logical (or dichotomous categorical) vector

f

a factor, specifying treatment groups

tumour

the value which status obtains if a tumour is present in an individual at time of death

symbol

symbol to indicate presence of tumour in the text representation

Value

A named list, containing a character string for each group

Author(s)

Frank Schaarschmidt

Examples

data(methyl)
methyl
poly3table(time=methyl$death, status=methyl$tumour,
 f=methyl$group, tumour = 1, symbol = "*")

Approximate simultaneous test for poly-3-adjusted tumour rates

Description

P-value of maximum test and adjusted p-values for M contrasts of I groups in a one-way layout. Based on approximation of the true distribution of the M test statistics by an M-variate normal distribution.

Usage

poly3test(time, status, f, type = "Dunnett",
 cmat = NULL, method = "BP", alternative = "two.sided",
dist="MVN", k=3, ...)

Arguments

time

a numeric vector of times of death of the individuals

status

a logical (or numeric, consisting of 0,1 only) vector giving the tumour status at time of death of each individual, where TRUE (1) = tumour present, FALSE (0) = no tumour present

f

a factor of the same length as time, status, giving the levels of a grouping variable in a one-way layout

type

a character string specifying the contrast type

cmat

an optional user defined contrast matrix of dimension MxI

method

a single charcter string, specifying the method for adjustment, with options: "BP" (Bailer Portier: assuming poly-3-adjusted rates are binomial variables), "BW" (Bieler, Williams: delta method as in Bieler-Williams (1993)) "ADD1" (as Bailer Portier, including an add1-adjustment on the raw tumour rates) "ADD2" (as Bailer Portier, including an add2-adjustment on the raw tumour rates following Agresti Caffo (2000) for binomials)

alternative

a character string specifying the direction of the alternative hypothesis

dist

a character string, where "MVN" invokes the computation of p-values using the multivariate normal distribution, and "N" invokes use p-value computation using the univariate normal distribution

k

a single numeric value, the exponent to calculate survival adjusted proportions according to Bailer and Portier (1988), defaults to 3

...

further arguments to be passed; currently only base, to choose the control group with type="Dunnett"

Details

Testversion.

Value

An object of class "poly3test", a list containing:

teststat

a numeric vector of teststatistics of length M

pval

a single numeric p-value, the p-value of the maximum test (minimum p-value)

p.val.adj

a vector of length M, the adjusted p-values of the single contrasts

alternative

a single character vector, as the input

dist

a character string specifying which distribution

time

as input

status

as input

f

as input

method

as input

cmat

used contrast matrix

sample.est

a list containing sample estimates

Note

Please note that all methods here described are only approximative, and might violate the nominal level in certain situations. Please note further that appropriateness of the point estimates, and consequently of tests and confidence intervals is based on the assumptions in Bailer and Portier (1988), which might be a matter of controversies.

References

Assumptions corresponding to the poly-k-adjustment:

Bailer, J.A. and Portier, C.J. (1988): Effects of treatment-induced mortality and tumor-induced mortality on tests for carcinogenicity in small samples. Biometrics 44, 417-431.

Peddada, S.D., Dinse, G.E., and Haseman, J.K. (2005): A survival-adjusted quantal response test for comparing tumor incidence rates. Applied Statistics 54, 51-61.

Statistical procedures and characterization of coverage probabilities are described in: Sill, M. (2007): Approximate simultaneous confidence intervals for multiple comparisons of binomial proportions. Master thesis, Institute of Biostatistics, Leibniz University Hannover.

Examples

# poly-3-adjusted tumour rates with a potential
# down-turn effect for the highest dose group "4":

data(methyl)

# many-to-one:
methylD<-poly3test(time=methyl$death, status=methyl$tumour,
 f=methyl$group, type = "Dunnett", method = "ADD1")

methylD

# Williams-Contrast:
methylW<-poly3test(time=methyl$death, status=methyl$tumour,
 f=methyl$group, type = "Williams", method = "ADD1", alternative="greater" )

methylW

# Changepoint-Contrast:
methylCh<-poly3test(time=methyl$death, status=methyl$tumour,
 f=methyl$group, type = "Change", method = "ADD1", alternative="greater" )

methylCh

Approximate power for multiple contrast tests of binomial proportions.

Description

Approximative power calculation for multiple contrast tests of binomial proportions (based on risk differences, or odds ratios), based on probabilities of the multivariate standard normal distribution.

Usage

powerbinom(p, n, alpha = 0.05, type = "Dunnett", cmat = NULL,
 rhs = 0, alternative = c("two.sided", "less", "greater"),
 ptype = c("global", "anypair", "allpair"), method = "Wald", crit = NULL, ...)

powerbinomOR(p, n, alpha = 0.05, type = "Dunnett", cmat = NULL, 
    rhs = 1, alternative = c("two.sided", "less", "greater"), 
    ptype = c("global", "anypair", "allpair"), 
    crit = NULL, ...)

Arguments

p

a numeric vector of assumed true proportions under the alternative hypothesis where length(p) is the number of (treatment) groups in the multiple comparison problem

n

a vector (of integer values), the number of observations per (treatment) group, must have the same length as p

alpha

a single numeric value, the alpha-level of the test, default is 0.05

type

a single charcater string naming the type of multiple contrast test to be applied on the proportions p; will be ignored if argument cmat is specified; for possible choices, see contrMat

cmat

optional, a matrix fo contrast coefficients (with number of columns = number of treatmenmt groups and number of rows = number of comparisons); if cmat is not specified, the type of multiple contrast test to be applied on the proportions p is chosen according to argument type

rhs

a (vector of) numeric value(s), specifying the right hand sides of the alternative hypotheses, default is 0 for the risk difference (powerbinom), and 1 for the odds ratio (powerbinomOR), if values greater or less than the default are specified, power for shifted tests (non-inferiority, superiority) is computed; Note that the latter primarily makes sense for one-sided hypotheses. A warning is given when alternative ="two.sided" with rhs!=0 or rhs!=1 for difference or oddsratios, respectively.

alternative

a character string, specifying the direction of the alternative hypotheses, options are "two.sided", "less", "greater"; alternative primarily controls for which directional decisions power is calculated, in case that argument crit is not specified, alternative also controls the choice of the critical value.

ptype

a single character string, naming the type of rejection probability to be computed; options are "global" for the overall rejection probability (irrespective which contrasts are under the null or the alternative), "anypair" for the rejection probability considering only those contrasts under the alternative, "global" for the probability that all elementary alternatives are rejected.

method

a character string, the method for variance estimation in test / confidence interval construction: one of "Wald", "ADD1", "ADD2".

crit

a single numeric value to serve as equicoordinate critical point in the multiple test; if it is not specified, it is computed as a quantile of the multivariate normal distribution based on the specifications in arguments n, cmat (or type); note that for alternatives 'two.sided' and 'greater', crit should be a single positive value, while for alternative 'less', crit should be a single negative value.

...

further arguments, which are passed to the functions qmvnorm and pmvnorm, mainly to control the computation errors, see GenzBretz in package mvtnorm for details

Details

For (standard type and user-defined) multiple contrast tests of proportions in 2xk contigency tables assuming the binomial distribution and k treatment groups, different types of rejection probabilities in the multiple testing problem can be computed. Based on a central multivariate normal distribution, equicoordinate critical points for the test are computed, different critical points for the test can be specified in crit.

Via computing probabilities of non-central multivariate normal distributions pmvt(mvtnorm) one can calculate:

The global rejection probability (power="global"), i.e. the probability that at least one of the elementary null hypotheses is rejected, irrespective, whether this (or any contrast!) is under the corresponding elementary alternative). As a consequence this probability involves elementary type-II-errors for those contrasts which are under their elementary null hypothesis.

The probability to reject at least one of those elementary null hypotheses which are indeed under their corresponding elementary alternatives (ptype="anypair"). Technically, this is achieved by omitting those contrasts under the elementary null and, for a given critical value, compute the rejection probability from a multivariate normal distribution with reduced dimension. Note that for 'two-sided' alternatives, type III-errors (rejection of the two-sided null in favor of the wrong direction) are included in the power.

The probability to reject all elementary null hypotheses which are indeed under their corresponding elementary alternatives (power="allpair"). Also here, for 'two-sided' alternatives, the type III-error contributes to the computed 'allpair power'. Note further that two-sided allpair power is simulated based on multivariate normal random numbers.

Whether a given hypothesis is under the alternative hypothesis is currently checked via abs(L-rhs) > 10*.Machine$double.eps, where L is the constrasts true value depending on p and the contrast matrix and rhs the right hand side of the null hypothesis. For alternatives "less" or "greater", the corresponding checks are: (L-rhs) < -10*.Machine$double.eps and (L-rhs) > 10*.Machine$double.eps, respectively.

For the case of differences or proportion (powerbinom) the underlying methods are closely related to those described in Bretz and Hothorn (2002). The methods here differ from that of Bretz and Hothorn (2002) by using a variance estimator in the teststatistic based of unpooled sample rpoportions, not a pooled variances estimator under H0. A description is also given in Schaarschmidt, Biesheuvel and Hothorn, 2009. The method implemented for the odds ratio corresponds to the asymptotic intervals given in Holford et al. 1989, the power computation is a straightforward generalization of the methods above, assuming asymptotic normality at the scale of log odds.

Value

A list consisting of the following items:

power

a numeric value the computed power, with estimated computational error as an attribute

p

the input vector of expected groupwise proportions

n

the input vector of group sample sizes

conexp

a data frame containing the contrast matrix, the expected values of the contrasts given p (expContrast), the right hand sides of the hypotheses (rhs, as input), the expected values of the test statistics corresponding to the contrasts and rhs, and a column of logical values indicating whether the corresponding contrasts was under the alternative (under HA)

crit

a single numeric value, the critical value used for power computation

alternative

a single character string, as input

ptype

a single character string, as input

alpha

a single numeric value, as input

Warning

Note that the the tests for which power is computed as well as the power computation itself relies on simple approximations of binomial distribution by normal distributions. It is known that the test procedures do not control FWER for small n and extreme proportions p. Hence, computed power may substantially deviate from the true power of the methods a) due to the fact that the tests have sizes deviating from the nominal level, b) due to insufficient approximation in the power calculation. Simulations show that absolute deviations of approximate power from simulated power are large if low values of n*p or n*(1-p) are involved and if power is low (i.e. power<0.3).

Author(s)

Frank Schaarschmidt

References

Genz A, Bretz F (1999): Numerical computation of multivariate t-probabilities with application to power calculation of multiple contrasts. Journal of Statistical Computation and Simulation, 63, 4, 361-378.

Bretz F, Hothorn LA (2002): Detecting dose-response using contrasts: asymptotic power and sample size determination for binomial data. Statistics in Medicine, 21, 22, 3325-3335.

Holford, TR, Walter, SD and Dunnett, CW (1989): Simultaneous interval estimates of the odds ratio in studies with two or more comparisons. Journal of Clinical Epidemiology 42, 427-434.

Schaarschmidt F, Biesheuvel E, Hothorn LA (2009): Asymptotic simultaneous confidence intervals for many-to-one comparisons of binray proportions in randomized clinical trials. Journal of Biopharmaceutical Statistics 19, 292-310.

Examples

# Assume, one wants to perform a test for increasing trend
#  using Williams type of contrasts among I=5 groups
#  (e.g. 4 doses and one control).
#  Proportions are assumed to have values
#  pi=(0.1,0.12,0.14,0.14,0.2) under the alternative.

powerbinom(p=c(0.1, 0.12, 0.14, 0.14, 0.2),
 n=c(100,100,100,100,100), type = "Williams",
 alternative = "greater")

powerbinom(p=c(0.1, 0.12, 0.14, 0.14, 0.2),
 n=c(150,150,150,150,150), type = "Williams",
 alternative = "greater")

powerbinom(p=c(0.1, 0.12, 0.14, 0.14, 0.2),
 n=c(190,140,140,140,140), type = "Williams",
 alternative = "greater")


# probability to show for at least one group (2,3,4)
# a significant reduction versus control (1)

powerbinom(p=c(0.3, 0.15, 0.15, 0.15),
 n=c(140,140,140,140), type = "Dunnett",
 alternative = "less")

# probability to show for at least one group (2,3,4)
# a significant reduction versus control (1) of more 
# than 0.05 percent

powerbinom(p=c(0.3, 0.15, 0.15, 0.15),
 n=c(140,140,140,140), type = "Dunnett",
 alternative = "less", rhs=-0.05)

# probability to show for all groups (2,3,4)
# a significant reduction versus control (1) of more 
# than 0.05 percent

powerbinom(p=c(0.3, 0.15, 0.15, 0.15),
 n=c(140,140,140,140), type = "Dunnett",
 alternative = "less", rhs=-0.05, ptype="allpair")


# probability to show for at least one group (2,3,4)
# a significant reduction versus control (1)

powerbinom(p=c(0.3, 0.15, 0.15, 0.15),
 n=c(140,140,140,140), type = "Dunnett",
 alternative = "less")


powerbinomOR(p=c(0.3, 0.15, 0.15, 0.15),
 n=c(140,140,140,140), type = "Dunnett",
 alternative = "less")

Approximative power calculation for multiple contrast tests

Description

Approximative power calculation for multiple contrast tests which are based on normal approximation.

Usage

powermcpn(ExpTeststat, corrH1, crit, alternative = c("two.sided", "less", "greater"),
 alpha = 0.05, ptype = c("global", "anypair", "allpair"), ...)

Arguments

ExpTeststat

numeric vector: the expectation of the test statistics under the alternative

corrH1

a numeric matrix, the correlation matrix of the teststatistics under the alternative, must have same number of columns and rows as length of ExpTeststat

crit

a single numeric value, the critical value of the test; if not specified a critical value is computed as an equicoordinate (1-alpha) quantile of a central multivariate normal distribution with correlation corrH1

alternative

a character string, specifying the direction of the alternative hypotheses, options are "two.sided", "less", "greater"; alternative primarily controls for which directional decisions power is calculated, in case that argument crit is not specified, alternative also controls the choice of the critical value.

alpha

a single numeric value: the FWER for the multiple test, defaults to 0.05

ptype

a single character string, naming the type of rejection probability to be computed; options are "global" for the overall rejection probability (irrespective which contrasts are under the null or the alternative), "anypair" for the rejection probability considering only those contrasts under the alternative, "global" for the probability that all elementary alternatives are rejected.

...

further arguments, which are passed to the functions qmvnorm and pmvnorm, mainly to control the computation errors, see help GenzBretz(mvtnorm) for details

Details

For (standard type and user-defined) multiple contrast tests based on approximation with the multivariate normal distribution, three types of rejection probabilities in the multiple testing problem can be computed.

The global rejection probability (power="global"), i.e. the probability that at least one of the elementary null hypotheses is rejected, irrespective, whether this (or any contrast!) is under the corresponding elementary alternative). As a consequence this probability involves elementary type-II-errors for those contrasts which are under their elementary null hypothesis.

The probability to reject at least one of those elementary null hypotheses which are indeed under their corresponding elementary alternatives (power="anypair"). Technically, this is achieved by omitting those contrasts under the elementary null and, for a given critical value, compute the rejection probability from a multivariate normal distribution with reduced dimension. Note that for 'two-sided' alternatives, type III-errors (rejection of the two-sided null in favor of the wrong direction) are included in the power.

The probability to reject all elementary null hypotheses which are indeed under their corresponding elementary alternatives (power="allpair"). Also here, for 'two-sided' alternatives type III-error contribute to the computed 'allpair power'. Note further that two-sided allpair power is simulated based on multivariate normal random numbers.

Whether a given hypothesis is under the alternative hypothesis is currently checked via abs(ExpTeststat) > 10*.Machine$double.eps, ExpTeststat < -10*.Machine$double.eps and ExpTeststat > 10*.Machine$double.eps, for alternatives c("two.sided", "less", "greater"), respectively.

Value

A list consisting of the following items:

power

a numeric value the computed power, with estimated computational error as an attribute

conexp

the expected values of the test statistics corresponding to the contrasts and rhs, and a column with [0,1] values, indicating whether the corresponding contrasts was under the alternative (1) or under the null (0)

crit

a single numeric value, the critical value used for power computation

alternative

a single character string, as input

ptype

a single character string, as input

alpha

a single numeric value, as input

Author(s)

Frank Schaarschmidt


Testversion. Power calculation for multiple contrast tests (1-way ANOVA model)

Description

Testversion. Calculate the power of a multiple contrast tests of k means in a model with homogeneous Gaussian errors, using the function pmvt(mvtnorm) to calculate multivariate t probabilities. Different options of power defineition are "global": the overall rejection probability (the probability that at the elementary null is rejected for at least one contrast, irrespective of being under the elementary null or alternative), "anypair": the probability to reject any of the elementary null hypotheses for those contrasts that are under the elmentary alternatives, "allpair": and the probability that all elementary nulls are rejected which are indeed under the elementary nulls. See Sections 'Details' and 'Warnings'!

Usage

powermcpt(mu, n, sd, cmat = NULL, rhs=0, type = "Dunnett",
 alternative = c("two.sided", "less", "greater"), alpha = 0.05,
 ptype = c("global", "anypair", "allpair"), crit = NULL, ...)

Arguments

mu

a numeric vector of expected values in the k treatment groups

n

a numeric vector of sample sizes in the k treatment groups

sd

a single numeric value, specifying the expected standard deviation of the residual error

cmat

optional specification of a contrast matrix; if specified, it should have as many columns as there are groups in arguments mu and n and it should have at least 2 rows, if specified, argument type is ignored, if not specified, the contrast is determined by argument type

rhs

numeric vector, specifying the right hand side of the hyptheses to test, defaults to 0, other specifications lead to tests of non-inferiority and superiority.

type

a single character string, naming one of the contrast types available in contrMat(multcomp); argument is ignored if cmat is specified

alternative

a single character string, specifying the direction of the alternative hypothesis, one of "two.sided","less","greater". Note that this argument governs how the multivariate t probabilities are evaluated as well as the computation of the critical value if none is specified (i.e. default crit=NULL)

alpha

a single numeric value, familywise type I error to be controlled, is ignored if argument crit is specified

ptype

a single character string, naming the type of rejection probability to be computed; options are "global" for the global rejection probability, "anypair" for the rejection probability considering only those contrasts under the alternative, "global" for the probability that all elementary alternatives are rejected.

crit

a single numeric value to serve as equicoordinate critical point in the multiple test; if it is not specified, it is computed as a quantile of the multivariate t distribution based on the specifications in arguments n, cmat (or type); note that for alternatives 'two.sided' and 'greater', crit should be a single positive value, while for alternative 'less', crit should be a single negative value.

...

further arguments, which are passed to the functions qmvt and pmvt, mainly to control the computation errors, see help GenzBretz(mvtnorm) for details

Details

In a homoscedastic Gaussian model with k possibly different means compared by (user-defined) multiple contrast tests, different types of rejection probabilities in the multiple testing problem can be computed. Based on a central multivariate t distribution with df=sum(n)-k appropriate equicoordinate critical points for the test are computed, different critical points can be specified in crit Computing probabilities of non-central multivariate t distributions pmvt(mvtnorm) one can calculate:

The global rejection probability (power="global"), i.e. the probability that at least one of the elementary null hypotheses is rejected, irrespective, whether this (or any contrast!) is under the corresponding elementary alternative). As a consequence this probability involves elementary type-II-errors for those contrasts which are under their elementary null hypothesis.

The probability to reject at least one of those elementary null hypotheses which are indeed under their corresponding elementary alternatives (power="anypair"). Technically, this is achieved by omitting those contrasts under the elementary null and compute the rejection probability for a given criticla value from a multivariate t distribution with reduced dimension. Note that for 'two-sided' alternatives, type III-errors (rejection of the two-sided null in favor of the wrong direction) are included in the power.

The probability to reject all elementary null hypotheses which are indeed under their corresponding elementary alternatives (power="allpair"). Also here, for 'two-sided' alternatives type III-error contribute to the computed 'allpair power'. Note further that two-sided allpair power is simulated based on multivariate t random numbers.

Value

A list consisting of the following items:

power

a numeric value the computed power, with estimated computational error as an attribute

mu

the input vector of expected values of group means

n

the input vector of group sample sizes

conexp

a data frame containing the contrast matrix, the expected values of the contrasts given mu (expContrast), the right hand sides of the hypotheses (rhs, as input), the expected values of the test statistics corresponding to the contrasts and rhs, and a column of logical values indicating whether the corresponding contrasts was under the alternative (under HA)

crit

a single numeric value, the critical value used for power computation

alternative

a single character string, as input

ptype

a single character string, as input

alpha

a single numeric value, as input

Warning

This is a test version, which has roughly (but not for an extensive number of settings) been checked by simulation. Any reports of errors/odd behaviour/amendments are welcome.

Author(s)

Frank Schaarschmidt

References

Genz A, Bretz F (1999): Numerical computation of multivariate t-probabilities with application to power calculation of multiple contrasts. Journal of Statistical Computation and Simulation, 63, 4, 361-378. Bretz F, Hothorn LA (2002): Detecting dose-response using contrasts: asymptotic power and sample size determination for binomial data. Statistics in Medicine, 21, 22, 3325-3335. Bretz F, Hayter AJ and Genz A (2001): Critical point and power calculations for the studentized range test for generally correlated means. Journal of Statistical Computation and Simulation, 71, 2, 85-97. Dilba G, Bretz F, Hothorn LA, Guiard V (2006): Power and sample size computations in simultaneous tests for non-inferiority based on relative margins. Statistics in Medicien 25, 1131-1147.

Examples

powermcpt(mu=c(3,3,5,7), n=c(10,10,10,10), sd=2, type = "Dunnett",
 alternative ="greater", ptype = "global")
powermcpt(mu=c(3,3,5,7), n=c(10,10,10,10), sd=2, type = "Williams",
 alternative ="greater", ptype = "global")

powermcpt(mu=c(3,3,5,7), n=c(10,10,10,10), sd=2, type = "Dunnett",
 alternative ="greater", ptype = "anypair")
powermcpt(mu=c(3,3,5,7), n=c(10,10,10,10), sd=2, type = "Williams",
 alternative ="greater", ptype = "anypair")

powermcpt(mu=c(3,4,5,7), n=c(10,10,10,10), sd=2, type = "Dunnett",
 alternative ="greater", ptype = "allpair")
powermcpt(mu=c(3,2,1,-1), n=c(10,10,10,10), sd=2, type = "Dunnett",
 alternative ="greater", ptype = "allpair")

Print out put of multinomORci

Description

For output of function multinomORci: print ot confidence intervals or coerce out put to a data.frame.

Usage

## S3 method for class 'multinomORci'
print(x, exp = TRUE, ...)
## S3 method for class 'multinomORci'
as.data.frame(x, row.names = NULL, optional = FALSE, exp = TRUE, ...)

Arguments

x

an object of class multinomORci

exp

logical; if exp=TRUE interval limits are exp-transformed to yield limits on the sclae of odds-ratios; if exp=FALSE interval limits are printed/Returned on the logit scale

row.names

see as.data.frame

optional

see as.data.frame

...

arguments to be passed to print, or as.data.frame

Examples

# fakle data: 3 categories (A,B,C) in 4 tretament groups c(co,d1,d2,d3)
dm <- rbind(
"co" = c(15,5,5),
"d1" = c(10,10,5),
"d2" = c(5,10,10),
"d3" = c(5,5, 15))
colnames(dm)<- c("A","B","C")

dm

#  define and name odds between categories
cmodds <- rbind(
"B/A"=c(-1,1,0),
"C/A"=c(-1,0,1))

#  define and name comparsions between groups
cmtrt <- rbind(
"d1/co"=c(-1,1,0,0),
"d2/co"=c(-1,0,1,0),
"d3/co"=c(-1,0,1,0))

TEST <- multinomORci(Ymat=dm, cmcat=cmodds, cmgroup=cmtrt, cimethod="DP", BSIM=1000, prior=1)
TEST
print(TEST, exp=FALSE)
as.data.frame(TEST)

Print methods for the classes in this package

Description

Print methods for objects of the corresponding classes.

Usage

## S3 method for class 'binomORci'
print(x, ...)
## S3 method for class 'binomRDci'
print(x, digits = 4, ...)
## S3 method for class 'binomRDtest'
print(x, digits = 4, ...)
## S3 method for class 'binomRRci'
print(x, digits = 4, ...)
## S3 method for class 'poly3ci'
print(x, digits = 4, ...)
## S3 method for class 'poly3est'
print(x, digits = 4, ...)
## S3 method for class 'poly3test'
print(x, digits = 4, ...)
## S3 method for class 'Shannonci'
print(x, ...)
## S3 method for class 'Simpsonci'
print(x, ...)

Arguments

x

an object of the corresponding class

digits

the number of digits to be used for rounding

...

...

Value

A print out.


Compute a rectangular simultaneous confidence set from a sample of a joint empirical distribution.

Description

Given a large sample of N values from an M dimensional joint empirical distribution, the rank based method of Besag et al. (1995) is used to compute a rectangular M-dimensional 'confidence' set that includes N*conf.level values of the sample.

Usage

SCSrank(x, conf.level = 0.95, alternative = "two.sided", ...)

Arguments

x

an N x M matrix containg N sampled values of the M dimensional distribution of interest

conf.level

the simultaneous confidence level, a single numeric value between 0 and 1, defaults to 0.95 for simultaneous 95 percent sets

alternative

a single character string related to hypotheses testing, "two.sided" invokes two-sided confidence sets, "less" invokes sets with upper limits only and "greater" invokes sets with lower limits only,

...

currently ignored

Value

an Mx2 (alternative="two.sided") matrix containing the lower and upper confidence limist for the M dimensions, in case of alternative="less", alternative="greater" the lower and upper bounds are replaced by -Inf and Inf, respectively.

Author(s)

Frank Schaarschmidt

References

Besag J, Green P, Higdon D, Mengersen K (1995). Bayesian Computation and Stochastic Systems. Statistical Science 10, 3-66. Mandel M, Betensky RA. Simultaneous confidence intervals based on the percentile bootstrap approach. Computational Statistics and Data Analysis 2008; 52(4): 2158-2165.

Examples

x <- cbind(rnorm(1000,1,2), rnorm(1000,0,2), rnorm(1000,0,0.5), rnorm(1000,2,1))
dim(x)
cm <- rbind(c(-1,1,0,0), c(-1,0,1,0), c(-1, 0,0,1))
xd <- t(apply(x, 1, function(x){crossprod(t(cm), matrix(x))}))
pairs(xd)

SCSrank(xd, conf.level=0.9)

Confidence intervals for multiple contrasts of Shannon indices

Description

Calculates simultaneous and local confidence intervals for differences of Shannon indices under the assumption of multinomial count data.

Usage

Shannonci(X, f, cmat = NULL, type = "Dunnett", alternative = "two.sided",
 conf.level = 0.95, dist = "MVN", ...)

Arguments

X

a data.frame of dimensions n times p with integer entries, where n is the number of samples and p is the number of species

f

a factor variable of length n, grouping the observations in X

cmat

an contrast matrix; the number of columns should match the number of levels in f

type

a single character string, currently one of "Dunnett","Tukey","Sequen"

alternative

a single character string, one of "two.sided","less" (upper bounds),"greater" (lower bounds)

conf.level

the confidence level of the simultaneous (or local) confidence intervals

dist

a single character string, defining the type of quantiles to be used for interval calculation; "MVN" invokes simultaneous intervals, "N" invokes unadjusted confidence intervals with coverage probability conf.level for each of them

...

further arguments to be passed; currently only base is used, a single integer value, specifying which group to be taken as the control in case that type="Dunnett", ignored otherwise

Details

This function implements confidence intervals described by Fritsch and Hsu (1999) for the difference of Shannon indices between several groups. Deviating from Fritsch and Hsu, quantiles of the multivariate normal distribution based on a plug-in-estamator for the correlation matrix.

Note, that this approach, by assuming multinomial distribution for the vectors of counts, ignores the variability of the individual samples. If such extra-multinomial variatio is present in the data, the intervals will be too narrow, coverage probability will be substantially lower than specified in 'conf.level'. Consider approaches based on bootstrap instead (e.g., package simboot).

Value

A list containing the elements:

conf.int

a matrix, containing the lower and upper confidence limits in the columns

quantile

a single numeric value, the quantile used for interval calculation

estimate

a matrix,containing the point estimates of the contrasts in its column

cmat

the contrast matrix used

methodname

a character string, for printing

sample.estimate

A list of sample estimates as returned by estShannonf

and some of the input arguments

Author(s)

Frank Schaarschmidt

References

Fritsch, KS, and Hsu, JC (1999): Multiple Comparison of Entropies with Application to Dinosaur Biodiversity. Biometrics 55, 1300-1305. Scherer, R, Schaarschmidt, F, Prescher, S, and Priesnitz, KU (2013): Simultaneous confidence intervals for comparing biodiversity indices estimated from overdispersed count data. Biometrical Journal 55,246-263.

See Also

Simpsonci for simultaneous and local intervals of differences of the Simpson index

Examples

data(HCD)

HCDcounts<-HCD[,-1]
HCDf<-HCD[,1]

# Comparison to the confidence bounds shown in
# Fritsch and Hsu (1999), Table 5, "Standard normal".

cmat<-rbind(
"HM-HU"=c(0,1,-1),
"HL-HM"=c(1,-1,0),
"HL-HU"=c(1,0,-1)
)

Shannonci(X=HCDcounts, f=HCDf, cmat=cmat,
 alternative = "two.sided", conf.level = 0.9, dist = "N")

# Note, that the calculated confidence intervals
# differ from those published by Fritsch and Hsu (1999),
# whenever Lower is involved.



# Comparison to the lower cretaceous,
# unadjusted confidence intervals:

Shannonci(X=HCDcounts, f=HCDf, type = "Dunnett",
 alternative = "greater", conf.level = 0.9, dist = "N")

# Stepwise comparison between the strata,
# unadjusted confidence intervals:

ShannonS<-Shannonci(X=HCDcounts, f=HCDf, type = "Sequen",
 alternative = "greater", conf.level = 0.9, dist = "N")


ShannonS

summary(ShannonS)

plot(ShannonS)


# A trend test based on multiple contrasts:

cmatTREND<-rbind(
"U-LM"=c(-0.5,-0.5,1),
"MU-L"=c(-1,0.5,0.5),
"U-L"=c(-1,0,1)
)

TrendCI<-Shannonci(X=HCDcounts, f=HCDf, cmat=cmatTREND,
 alternative = "greater", conf.level = 0.95, dist = "MVN")
TrendCI

plot(TrendCI)

Confidence intervals for differences of Simpson indices

Description

Calculates simultaneous and local confidence intervals for differences of Simpson indices under the assumption of multinomial count data.

Usage

Simpsonci(X, f, cmat = NULL, type = "Dunnett",
 alternative = "two.sided", conf.level = 0.95, dist = "MVN", ...)

Arguments

X

a data.frame of dimensions n times p with integer entries, where n is the number of samples and p is the number of species

f

a factor variable of length n, grouping the observations in X

cmat

an contrast matrix; the number of columns should match the number of levels in f

type

a single character string, currently one of "Dunnett","Tukey","Sequen"

alternative

a single character string, one of "two.sided","less" (upper bounds),"greater" (lower bounds)

conf.level

the confidence level of the simultaneous (or local) confidence intervals

dist

a single character string, defining the type of quantiles to be used for interval calculation; "MVN" invokes simultaneous intervals, "N" invokes unadjusted confidence intervals with coverage probability conf.level for each of them

...

further arguments to be passed; currently only base is used,a single integer value, specifying which group to be taken as the control in case that type="Dunnett", ignored otherwise

Details

This function implements confidence intervals described by Rogers and Hsu (1999) for the difference of Shannon indices between several groups. Deviating from Fritsch and Hsu, quantiles of the multivariate normal distribution based on a plug-in-estamator for the correlation matrix.

Note, that this approach, by assuming multinomial distribution for the vectors of counts, ignores the variability of the individual samples. If such extra-multinomial variatio is present in the data, the intervals will be too narrow, coverage probability will be substantially lower than specified in 'conf.level'. Consider approaches based on bootstrap instead (e.g., package simboot).

Value

A list containing the elements:

conf.int

a matrix, containing the lower and upper confidence limits in the columns

quantile

a single numeric value, the quantile used for interval calculation

estimate

a matrix,containing the point estimates of the contrasts in its column

cmat

the contrast matrix used

methodname

a character string, for printing

sample.estimate

A list of sample estimates as returned by estShannonf

and some of the input arguments.

Author(s)

Frank Schaarschmidt

References

Rogers, JA and Hsu, JC (2001): Multiple Comparisons of Biodiversity. Biometrical Journal 43, 617-625.

See Also

Shannonci

Examples

data(HCD)

HCDcounts<-HCD[,-1]
HCDf<-HCD[,1]

# Rogers and Hsu (2001), Table 2:
# All pair wise comparisons:

Simpsonci(X=HCDcounts, f=HCDf, type = "Tukey",
 conf.level = 0.95, dist = "MVN")

# Rogers and Hsu (2001), Table 3:
# Comparison to the lower cretaceous:

Simpsonci(X=HCDcounts, f=HCDf, type = "Dunnett",
 alternative = "less", conf.level = 0.95, dist = "MVN")


# Note, that the confidence bounds here differ
# from the bounds in Rogers and Hsu (2001) 
# in the second digit, whenever the group Upper
# is involved in the comparison.


# Stepwise comparison between the strata:

SimpsonS<-Simpsonci(X=HCDcounts, f=HCDf, type = "Sequen",
 alternative = "greater", conf.level = 0.95, dist = "MVN")

SimpsonS
summary(SimpsonS)

plot(SimpsonS)

# # # Hell Creek Dinosaur data:
# Is there a downward trend in biodiversity during the 
# Creataceous period?

# A trend test based on multiple contrasts:

cmatTREND<-rbind(
"U-LM"=c(-0.5,-0.5,1),
"MU-L"=c(-1,0.5,0.5),
"U-L"=c(-1,0,1)
)

TrendCI<-Simpsonci(X=HCDcounts, f=HCDf, cmat=cmatTREND, 
 alternative = "greater", conf.level = 0.95, dist = "MVN")
TrendCI

plot(TrendCI)

Detailed print out for binomORci

Description

Produces a more detailed print out of objects of class "binomORci", including summary statistics, the used contrast matrix and the confidence intervals.

Usage

## S3 method for class 'binomORci'
summary(object, ...)

Arguments

object

an object of class "binomORci" as created by function binomORci

...

...

Value

A print out.

Examples

x<-c(1,3,6,7,5)
n<-c(30,30,30,30,30)
names<-LETTERS[1:5]

ORD<-binomORci(x=x, n=n, names=names,
 type="Dunnett", alternative="greater")
summary(ORD)

ORW<-binomORci(x=x, n=n, names=names,
 type="Williams", alternative="greater")
summary(ORW)

Detailed print out for binomRDci

Description

Produces a more detailed print out of objects of class "binomRDci", including summary statistics, the used contrast matrix and the confidence intervals.

Usage

## S3 method for class 'binomRDci'
summary(object, ...)

Arguments

object

an object of class "binomRDci" as created by function binomRDci

...

further arguments to be passed to summary, currently only digits for rounding is supported

Value

A print out.

Examples

data(liarozole)

head(liarozole)

LiWi<-binomRDci(Improved ~ Treatment, data=liarozole,
 type="Williams")

LiWi

summary(LiWi)

Detailed print out for binomRDtest

Description

Produces a more detailed print out of objects of class "binomRDtest", including summary statistics, the used contrast matrix and the p-values.

Usage

## S3 method for class 'binomRDtest'
summary(object, ...)

Arguments

object

an object of class "binomRDtest" as created by function binomRDtest

...

further arguments to be passed to summary, currently only digits for rounding is supported

Value

A print out.

Examples

ntrials <- c(40,20,20,20)
xsuccesses <- c(1,2,2,4)
names(xsuccesses) <- LETTERS[1:4]
test<-binomRDtest(x=xsuccesses, n=ntrials, method="ADD1",
 type="Changepoint", alternative="greater")

test

summary(test)

Detailed print out for binomRRci

Description

Produces a more detailed print out of objects of class "binomRRci", including summary statistics, the used contrast matrix and the confidence intervals.

Usage

## S3 method for class 'binomRRci'
summary(object, ...)

Arguments

object

an object of class "binomRRci" as created by function binomRRci

...

further arguments to be passed to summary, currently only digits for rounding is supported

Value

A print out.

Examples

data(liarozole)

head(liarozole)

LiDu<-binomRRci(Improved ~ Treatment, data=liarozole,
 type="Dunnett", alternative="greater")

LiDu

summary(LiDu)

Detailed print out for poly3est

Description

Summary statistics for long-term carcinogenicity data, including poly-3-estimates. For internal use.

Usage

## S3 method for class 'poly3est'
summary(object, ...)

Arguments

object

An object of class "poly3est", as can be obtained by poly3est

...

further argument for the print out, as e.g. digits for rounding

Details

For internal use.

Value

A print out.

Author(s)

Frank Schaarschmidt

Examples

data(methyl)
head(methyl)

estk3<-poly3estf(time=methyl$death, status=methyl$tumour, f=methyl$group)
summary(estk3)

estk5<-poly3estf(time=methyl$death, status=methyl$tumour, f=methyl$group, k=5)
summary(estk5)

Summary for Shannonci

Description

Produces a detailed print out of the results of the function Shannonci.

Usage

## S3 method for class 'Shannonci'
summary(object, ...)

Arguments

object

An object of class "Shannonci", see Shannonci

...

further arguments to be passed to print, currently only digits

Value

A print out, comprising a table of the (possibly aggregated) data used for estimation, the sample estimates for the Shannon index with bias corrected and raw values, its variance estimates, the used contrast matrix, and the confidence intervals.

Examples

data(HCD)

HCDcounts<-HCD[,-1]
HCDf<-HCD[,1]

# Comparison to the confidence bounds shown in
# Fritsch and Hsu (1999), Table 5, "Standard normal".

cmat<-rbind(
"HM-HU"=c(0,1,-1),
"HL-HM"=c(1,-1,0),
"HL-HU"=c(1,0,-1)
)

ShannonS<-Shannonci(X=HCDcounts, f=HCDf, type = "Sequen",
 alternative = "greater", conf.level = 0.9, dist = "N")

summary(ShannonS)

Summary function for Simpsonci

Description

Produces a detailed print out of the results of function Simpsonci.

Usage

## S3 method for class 'Simpsonci'
summary(object, ...)

Arguments

object

an object of class "Simpsonci" as obtained by calling Simpsonci

...

further arguments to be passed to print and round: currently only digits

Value

A print out, comprising a table of the (possibly aggregated) data used for estimation, the sample estimates for the Simpsons index, and its variance estimates, the used contrast matrix, and the confidence intervals.

Examples

data(HCD)

HCDcounts<-HCD[,-1]
HCDf<-HCD[,1]

SimpsonS<-Simpsonci(X=HCDcounts, f=HCDf, type = "Sequen",
 alternative = "greater", conf.level = 0.95, dist = "MVN")

summary(SimpsonS)

Simultaneous Wald confidence intervals

Description

General function for simultaneous CIs in a one-way layout using multivariate normal distribution.

Usage

Waldci(cmat, estp, varp, varcor, alternative = "two.sided", conf.level = 0.95, dist="MVN")

Arguments

cmat

Contrast matrix of dimension MxI, with M = the number of contrasts, I= the number of samples

estp

numeric vector of point estimates of length I, with I = the number of samples

varp

numeric vector of variance estimates of length I, to be used for interval construction

varcor

numeric vector of variance estimates of length I

alternative

character string

conf.level

single numeric vector

dist

a character string, "MVN" invokes multiplicity adjustment via the multivariate normal distribution, "N" invokes use of quantiles of the univariate normal distribution

Details

Mainly for internal use.

Value

A list containing:

conf.int

a matrix with 2 columns: lower and upper confidence bounds, and M rows

alternative

character string, as input

conf.level

single numeric value, as input

quantile

the quantile used to construct the CIs

Author(s)

Frank Schaarschmidt

See Also

For user level implementations see: binomRDci, binomORci, poly3ci


Simultaneous Wald tests

Description

General function for adjusted p-values for an UIT in a one-way layout using multivariate normal distribution.

Usage

Waldtest(estp, varp, cmat, alternative = "greater", dist="MVN")

Arguments

estp

numeric vector of point estimates of length I, with I = the number of samples

varp

numeric vector of variance estimates of length I, to be used for interval construction

cmat

Contrast matrix of dimension MxI, with M = the number of contrasts, I= the number of samples

alternative

character string

dist

a character string, where "MVN" invokes the computation of p-values using the multivariate normal distribution, and "N" invokes use p-value computation using the univariate normal distribution

Value

A list containing:

teststat

a numeric vector of teststatistics of length M

pval

a single numeric p-value, the p-value of the maximum test (minimum p-value)

p.val.adj

a vector of length M, the adjusted p-values of the single contrasts

alternative

a single character vector, as the input

dist

a character string specifying which distribution

Author(s)

Frank Schaarschmidt

See Also

For user level implementations see:

binomRDtest, poly3test