Type: Package
Title: Analyzing Combination of Proportions and Relative Risk
Version: 1.2
Date: 2017-03-05
Author: Maria Alvarez and Javier Roca-Pardinas
Maintainer: Maria Alvarez <maria.alvarez@uvigo.es>
Depends: rootSolve
Description: Carrying out inferences about any linear combination of proportions and the ratio of two proportions.
License: GPL-2 | GPL-3 [expanded from: GPL]
NeedsCompilation: no
Packaged: 2017-03-08 12:56:31 UTC; EME
Repository: CRAN
Date/Publication: 2017-03-08 16:37:48

Inferences about a linear combination of proportions

Description

prop.comb.RR enables to solve asymptotic inferences (p-values of test and confidence intervals) about any linear combination of independent proportions and the relative risk by means of optimal procedures and the well-known score procedure. It also provides summary measures and a recommendation about the best method that the researcher should choose in each particular case.

Author(s)

Maria Alvarez Hernandez and Javier Roca Pardinas roca@uvigo.es

Maintainer: Maria Alvarez Hernandez maria.alvarez@uvigo.es


prop.RR

Description

Main function for making inferences (confidence intervals and tests) about the relative risk using optimal methods from the literature and score method.

Usage

prop.RR(x, n, rho = NULL, alternative = c("two.sided", "less", "greater"), 
conf.level = 0.95, coverage = FALSE, nrep = 1000)

Arguments

x

a vector of counts of successes.

n

a vector of counts of samples sizes.

rho

hypothesized true value of the relative risk.

alternative

a character string specifying the alternative hypothesis, must be one of "two.sided" (default), "greater" or "less".

conf.level

confidence level of the returned confidence interval.

coverage

coverage probability of the confidence interval.

nrep

number of replays to calculate the estimated coverage probabilities

Value

Returns a list with the following components:

estimate

a vector with the sample proportions x/n.

RR

estimated relative risk.

inference

confidence intervals (lower limit, upper limit) and p-values of the test (with z-values of statistics. The coverage probabilities are included when the user requests them.

alternative

a character string describing the alternative hypothesis.

rho

hypothesized true value of the relative risk.

x

number of successes.

n

number of trials.

conf.level

confidence level of the confidence interval.

recommendation

recommended method by references.

Author(s)

Maria Alvarez Hernandez and Javier Roca Pardinas

References

Woolf, B. (1955). "On estimating the realtion between blood group disease." Annals of Human Genetics 19, 25-352.

Martin, A. & Alvarez, M. (2014). "Two-tailed approximate confidence intervals for the ratio of proportions." Statistics and Computing 24, 65 - 75.

Alvarez, M. & Martin, A. (2015). "New asymptotic inferences about the difference, ratio and linear combination of two independent proportions." Communications in Statistics - Simulation and Computation (in press).

See Also

prop.comb for inferences about a linear combination of K proportions

Examples

# The Relative Risk was used by Maxwell (1961) for the following data related to 
# the rate of occurrence of virus infection among the group of the non-inoculated 
# and the group of the inoculated. The objetive is to obtain an approximate 
# confidence interval for RR.

prop.RR(x=c(11, 48), n=c(46, 102), conf.level=0.99)

# Price and Bonnet (2008) reviewed a study in which the aim is to prove if
# the effect of the beta-blocker could be highly beneficial or slightly detrimental.

x=c(7, 14); n=c(114, 116); prop.RR(x, n, rho=2)

prop.comb

Description

Main function for making inferences (confidence intervals and tests) about a linear combination of proportions using optimal methods from the literature and score method.

Usage

prop.comb(x, n, p = NULL, a = NULL, alternative = c("two.sided", "less", "greater"),
 conf.level = 0.95, coverage = FALSE, nrep = 1000)

Arguments

x

a vector of counts of successes.

n

a vector of counts of samples sizes.

p

hypothesized true value of the interest parameter.

a

coefficients of the linear combination of proportions.

alternative

a character string specifying the alternative hypothesis, must be one of "two.sided" (default), "greater" or "less".

conf.level

confidence level of the returned confidence interval.

coverage

coverage probability of the confidence interval.

nrep

number of replays to calculate the estimated coverage probabilities

Details

Counts of successes must be nonnegative and hence not greater than the corresponding numbers of trials which must be positive. All finite counts should be integers.

It checks how many samples there are (k). When k=1, it will be the case of one proporcion. When k=2 and a=(-1,1), we will have the difference of proportions. In another case, the parameter of interest will be a linear combination of k proportions.

When k=1, automatically a=1 and the main function will assign p=0.5 if p=NULL. If k=2 and a=NULL, automatically a=c(-1,+1) and the main function will assign p=0 if p=NULL, i.e. test of homogeneity of proportions.

If alternative is NULL, the main function will automatically assign alternative="two.sided".

If conf.level is NULL, the main function will automatically assign conf.level=0.95.

If coverage is NULL or FALSE, the main function does not calculate the estimated coverage probabilities. Whereas, if coverage is TRUE, the main function calculates the estimated coverage probabilities. In this case, if nrep is NULL, the main function will automatically assign nrep=1000.

Value

Returns a list with the following components:

estimate

a vector with the sample proportions x/n.

a

coefficients of the linear combination of proportions.

L

estimated value of the interest parameter. L=difference for the d case.

inference

confidence intervals (lower limit, upper limit) and p-values of the test (with z-values of statistics). The coverage probabilities are included when the user requests them.

alternative

a character string describing the alternative hypothesis.

lambda

hypothesized true value of the interest parameter.

k

number of samples.

x

number of successes.

n

number of trials.

p

same value of lambda

conf.level

confidence level of the confidence interval.

recommendation

recommended method by references.

Author(s)

Maria Alvarez Hernandez and Javier Roca Pardinas

References

Wilson, E. (1927). "Probable inference, the law of succession, and statistical inference." Journal of the American Statistical Association, 22, 209 - 212

Agresti, A. & Coull, B. A. (1998). "Approximate is better than "exact" for interval estimation of binomial proportions." The American Statistician, 52, 119 - 126

Herranz, I. & Martin, A. (2008). "A numerical comparison of several unconditional exact tests in problems of equivalence based on the difference of proportions." Journal of Statistical Computation and Simulation, 78, 969 - 981

Martin, A.; Alvarez, M. & Herranz, I. (2011). "Inferences about a linear combination of proportions." Statistical Methods in Medical Research, 2011, 20, 369 - 387

Martin, A.; Herranz, I. & Alvarez, M. (2012). "The optimal method to make inferences about a lineal combination of proportions." Journal of Statistical Computation and Simulation, 82, 123 - 135

Martin, A.; Alvarez, M. & Herranz, I. (2012). "Asymptotic two-tailed confidence intervals for the difference of proportions." Journal of Applied Statistics, 39, 1423 - 1435

Martin, A. & Alvarez, M. (2013). "Optimal method for realizing two-sided inferences about a linear combination of two proportions." Communications in Statistics - Simulation and Computation, 42, 327 - 343

Martin, A. & Alvarez, M. (2014). "Two-tailed asymptotic inferences for a proportion." Journal of Applied Statistics, 41, 1516 - 1529

Yu, W.; Guo, X. & Xu, W. (2014). "An improved score interval with a modified midpoint for a binomial proportion." Journal of Statistical Computation and Simulation, 84, 1022 - 1038

Alvarez, M. & Martin, A. (2015). "New asymptotic inferences about the difference, ratio and linear combination of two independent proportions." Communications in Statistics - Simulation and Computation (in press).

See Also

prop.RR for inferences about the relative risk

Examples

# ONE PROPORTION
# Yu et al (2014) use a data set, which describes characteristics of some 
# American bridges. The objetive is to construct CIs for the proportion 
# of wood bridges.

prop.comb(x=16, n=109, alternative="two.sided", conf.level=0.95)

# DIFFERENCE OF TWO PROPORTION
# Rodary et al. (1989) studied the response to chemotherapy and radiation 
# therapy in a randomized clinical trial on nephroblastoma. 
# The main objetive is to contruct CIs about the difference of the response 
# and to contrast the homogeneity of proportions.

prop.comb(x=c(83,69), n=c(88,76), alternative="two.sided", conf.level=0.95)

# COMBINATION OF TWO PROPORTIONS
# Martin and Alvarez (2013) construct CIs about the parameter "loss associated
# with a diagnostic test" in the context of comparing two diagnostic tests 
# (Bloch, 1997) and use a data set by Hanley and McNeil (1983). 

prop.comb(x=c(44, 3), n=c(54, 58), a=c(-0.4, 0.6), 
alternative="two.sided", conf.level=0.95)

# Tebbs and Roths (2008) refer to data about a multicenter clinical trial whose
# aim was to evaluate the efficacy of a lowered salt regim in the treatment of male 
# infants with acute diarrhea. The objetive it to obtain a confidence interval about 
# the proportion of fever cases in South American area. 

prop.comb(x=c(32, 34), n=c(107, 92), a=c(107/199, 92/199), 
alternative="two.sided", conf.level=0.95)


# LINEAR COMBINATION OF K>3 PROPORTIONS
# Price and Bonett (2004) refer to a study by Cohen et al. (1991) in which 120 rats 
# were randomly assigned four diets (high or low fat and with or without fiber).
# The absence or presence of a tumor was recorded for each rat.
# The contrast of interest will evaluate the effects of study's variables.

# Data of diet and tumor study:
x <-c(20, 14, 27, 19); n <-c(30, 30, 30, 30)
a1 <-c(+1, -1, -1, +1); a2 <-c(+1, +1, -1, -1); a3 <-c(+1, -1, +1, -1)

prop.comb(x, n, a=a1); prop.comb(x, n, a=a2); prop.comb(x, n, a=a3)

Summary for a prop.RR object

Description

Provides results for an object of class prop.RR. It shows the contingency table with observed data, the parameter of interest and its estimated value. It provides confidence intervals (lower limit, upper limit) and p-values of the test (with z-values of statistics) for methods mentioned in references. It allows to calculate coverage probabilities for each method. It also indicates the alternative hypothesis and the recommendation about the optimal method for that particular case.

Usage

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

Arguments

object

an object of class prop.RR.

...

Further arguments for summary.

Author(s)

Maria Alvarez Hernandez and Javier Roca Pardinas

See Also

prop.RR

Examples

A <-prop.RR(x=c(11, 48), n=c(46, 102), conf.level=0.99)
summary(A)

B <-prop.RR(x=c(7, 14), n=c(114, 116), rho=2)
summary(B)

Summary for a prop.comb object

Description

Provides results for an object of class prop.comb. It shows the contingency table with observed data, the parameter of interest and its estimated value. It provides confidence intervals (lower limit, upper limit) and p-values of the test (with z-values of statistics) for methods mentioned in references. It allows to calculate coverage probabilities for each method. It also indicates the alternative hypothesis and the recommendation about the optimal method for that particular case.

Usage

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

Arguments

object

an object of class prop.comb.

...

Further arguments for summary.

Author(s)

Maria Alvarez Hernandez and Javier Roca Pardinas

See Also

prop.comb

Examples

# One proportion
A <-prop.comb(x=16, n=109, alternative="two.sided", conf.level=0.95)
summary(A)

# Difference of proportions
B <-prop.comb(x=c(83,69), n=c(88,76), alternative="two.sided", conf.level=0.95)
summary(B)

# Linear combination of two proportions
C <-prop.comb(x=c(44, 3), n=c(54, 58), a=c(-0.4, 0.6), alternative="two.sided", conf.level=0.95)
summary(C)

D <-prop.comb(x=c(32, 34), n=c(107, 92), a=c(107/199, 92/199), alternative="two.sided", 
conf.level=0.95)
summary(D)

# Linear combination of k>2 proportions
E <-prop.comb(x=c(73,32,44,34,104), n=c(158,107,175,92,143), 
a=c(158/675,107/675,175/675,92/675,143/675))
summary(E)