Package 'SensitivityCaseControl'

Title: Sensitivity Analysis for Case-Control Studies
Description: Sensitivity analysis for case-control studies in which some cases may meet a more narrow definition of being a case compared to other cases which only meet a broad definition. The sensitivity analyses are described in Small, Cheng, Halloran and Rosenbaum (2013, "Case Definition and Sensitivity Analysis", Journal of the American Statistical Association, 1457-1468). The functions sens.analysis.mh and sens.analysis.aberrant.rank provide sensitivity analyses based on the Mantel-Haenszel test statistic and aberrant rank test statistic as described in Rosenbaum (1991, "Sensitivity Analysis for Matched Case Control Studies", Biometrics); see also Section 1 of Small et al. The function adaptive.case.test provides adaptive inferences as described in Section 5 of Small et al. The function adaptive.noether.brown provides a sensitivity analysis for a matched cohort study based on an adaptive test. The other functions in the package are internal functions.
Authors: Dylan Small
Maintainer: Dylan Small <[email protected]>
License: GPL (>= 2)
Version: 2.2
Built: 2025-03-01 04:05:12 UTC
Source: https://github.com/cran/SensitivityCaseControl

Help Index


Sensitivity Analysis for Case-Control Studies

Description

This package performs sensitivity analysis for matched case-control studies in which some cases meet a narrow definition of being a case compared to other cases which only meet a broad definition. The package also implements an adaptive sensitivity analysis for matched pair cohort studies.

Details

Package: CaseSensitivity
Type: Package
Version: 1.0
Date: 2012-10-19
License: R 2.11.1
LazyLoad: yes

The functions sens.analysis.mh and sens.analysis.aberrant.rank provide sensitivity analyses based on the Mantel-Haenszel test statistic and aberrant rank test statistic. The function adaptive.case.test provides adaptive inferences that reject if either the Mantel-Haenszel statistic for the narrow cases is greater than a critical value or the Mantel-Haenszel statistic for all cases is greater than a critical value. The sensitivity analyses are described in Small, Cheng, Halloran and Rosenbaum (2012, "Case Definition and Sensitivity Analysis", working paper). The function adaptive.noether.brown provides a sensitivity analysis for a matched cohort study based on an adaptive test. The other functions in the package are internal functions.

Author(s)

Dylan Small <[email protected]>

References

Small, D.S., Cheng, J., Halloran, M.E. and Rosenbaum, P.R. (2013). "Case Definition and Design Sensitivity." Journal of the American Statistical Association, 108, 1457-1468.

Rosenbaum, P.R. (2012). "An Exact Adaptive Test with Superior Design Sensitivity in an Observational Study of Treatments for Ovarian Cancer." Annals of Applied Statistics, 6, 83-105.

Examples

# Adaptive test for a case-control study based on Table 4 in Small, Cheng, 
# Halloran and Rosenbaum (2013)
no.exposed.in.matched.set=c(rep(0,229),rep(1,23),rep(1,51),rep(2,9),rep(0,373),rep(1,46),rep(1,50),
rep(2,13));
narrowcase=c(rep(1,312),rep(0,482));
case.exposed=c(rep(0,229),rep(0,23),rep(1,51),rep(1,9),rep(0,373),rep(0,46),rep(1,50),rep(1,13));
size.matched.set=rep(2,length(case.exposed))
# Test using the statistics T1 and T1+T2 where T1 is Mantel-Haenszel for narrow cases and T2 is 
# Mantel Haenszel for marginal cases
adaptive.case.test(no.exposed.in.matched.set,narrowcase,case.exposed,size.matched.set,Gamma=1.37,
alpha=.05,narrowmultiplier=1)
# Test using the statistics T1 and 2*T1+T2
adaptive.case.test(no.exposed.in.matched.set,narrowcase,case.exposed,size.matched.set,Gamma=1.37,
alpha=.05,narrowmultiplier=2)

# Sensitivity analysis using only the narrow cases and the Mantel-Haenszel statistic
# Data from narrow cases in Table 1 of Small, Cheng and Halloran, Rosenbaum
cases.exposed=c(rep(0,174+60+14+4+0),rep(1,34+19+6+1+0));
referents.exposed=c(rep(0,174),rep(1,60),rep(2,14),rep(3,4),rep(0,34),rep(1,19),rep(2,6),rep(3,1));
no.referents=rep(4,312);
# Sensitivity analysis for Mantel-Haenszel statistic at Gamma=1.2
sens.analysis.mh(cases.exposed,referents.exposed,no.referents,Gamma=1.2);

# Adaptive test using Noether's and Brown's statstics for a matched cohort study
# Data on volume of hippocampus in 15 sets of twins in which one twin is affected by schizophrenia 
# and one twin is not (data from R.L. Suddath et al., "Anatomical Abnormalities in the Brains of 
# Monozygotic Twins Discordant for Schizophrenia," New England Journal of Medicine 322, 1990
# pp. 789-93.  Data taken from the Statistical Sleuth, F.L. Ramsey and D.W. Schafer
unaffected=c(1.94,1.44,1.56,1.58,2.06,1.66,1.75,1.77,1.78,1.92,1.25,1.93,2.04,1.62,2.08)
affected=c(1.27,16.3,1.47,1.39,1.93,1.26,1.71,1.67,1.28,1.85,1.02,1.34,2.02,1.59,1.97)
difference=unaffected-affected
adaptive.noether.brown(difference,Gamma=1.1)
# The null hypothesis of no treatment is rejected for Gamma=1.13 but not for Gamma=1.14

Adaptive sensitivity analysis for case-control studies

Description

This function carries out sensitivity analysis for matched case-control studies using two Mantel-Haenszel tests with different case definitions. The case in each matched set either meets a narrow case definition or only meets a more broadly defined case definition. The function can accommodate designs in which cases are matched to variable numbers of controls (referents).

Usage

adaptive.case.test(no.exposed.in.matched.set, narrowcase, case.exposed, size.matched.set, 
Gamma, narrowmultiplier = 1, alpha = 0.05)

Arguments

no.exposed.in.matched.set

Vector which gives the number of subjects exposed in each matched set.

narrowcase

Vector which contains 1 or 0 according to whether the case in the matched set meets the narrow case definition (1 if meets the narrow case definition).

case.exposed

Vector which is 1 or 0 according to whether the case in the matched set was exposed to the treatment (1 if exposed to treatment)

size.matched.set

Vector which contains the number of subjects in each matched set.

Gamma

The value of the sensitivity analysis parameter Gamma for which the test will be conducted.

narrowmultiplier

The amount by which the narrow cases are multiplied in the second test statistic (see Details). The default is 1.

alpha

The significance level at which the test is conducted (default = .05).

Details

The test being conducted is of the null hypothesis of no treatment effect vs. a one-sided alternative that exposure to the treatment increases the outcome. The result of the test is whether or not the null hypothesis can be rejected for all distributions of treatment assignments that are consistent with the sensitivity parameter Gamma. The sensitivity parameter Gamma is the maximum amount by which two subjects matched for observed covariates may differ in their odds of exposure to the treatment. The test is rejected if either the Mantel-Haenszel statistic among the narrow cases is greater than a critical value or narrowmultiplier*Mantel Haenszel statistic among the narrow cases + Mantel-Haenszel statistic among the broad ases is greater than another critical value, where the critical values are determined so that the probability of a Type I error is at most alpha. See Small, Cheng, Halloran and Rosenbaum (2013) for further details.

Value

alpha

Significance level at which the test is conducted.

Gamma

The value of the sensitivity parameter Gamma at which the test of the null hypothesis of no treatment effect is conducted.

testinfomat

Matrix with information about the test. The first column lists the definition of the two test statistics (one using only the narrow cases and the other using the narrow and marginal cases) that are being used in the adaptive test. T1 is the Mantel-Haenszel statistic among the narrow cases and T2 is the Mantel-Haenszel test statistic among the broad (narrow + marginal) cases. The second column lists the critical value for each test statistic. The third column lists the observed values of these two test statsitics. The null hypothesis is rejected if the observed value of either test statistic is greater than its critical value.

overall.test.result

"Accept H0" or "Reject H0" according to whether the null hypothesis of no treatment effect can be rejected for sensitivity parameter Gamma.

References

Small, D.S., Cheng, J., Halloran, M.E. and Rosenbaum, P.R. (2013). "Case Definition and Design Sensitivity." Journal of the American Statistical Association, 108, 1457-1468.

Examples

# Adaptive test based on Table 4 in Small, Cheng, Halloran and Rosenbaum (2013)
no.exposed.in.matched.set=c(rep(0,229),rep(1,23),rep(1,51),rep(2,9),rep(0,373),rep(1,46),rep(1,50),
rep(2,13));
narrowcase=c(rep(1,312),rep(0,482));
case.exposed=c(rep(0,229),rep(0,23),rep(1,51),rep(1,9),rep(0,373),rep(0,46),rep(1,50),rep(1,13));
size.matched.set=rep(2,length(case.exposed))
# Test using the statistics T1 and T1+T2 where T1 is Mantel-Haenszel for narrow cases and T2 is 
# Mantel Haenszel for marginal cases
adaptive.case.test(no.exposed.in.matched.set,narrowcase,case.exposed,size.matched.set,Gamma=1.37,
alpha=.05,narrowmultiplier=1)
# Test using the statistics T1 and 2*T1+T2
adaptive.case.test(no.exposed.in.matched.set,narrowcase,case.exposed,size.matched.set,Gamma=1.37,
alpha=.05,narrowmultiplier=2)

# An example of an adaptive test in which narrow cases are matched to two controls and marginal 
# cases to one control
#      Narrow Cases                    Marginal Cases
# Referents Exposed  0   1   2         0     1   
# Case
# Not Exposed        40  10   6        50    20  
# Exposed            30  14   8        40    30
no.exposed.in.matched.set=c(rep(0,40),rep(1,10),rep(2,6),rep(1,30),rep(2,14),rep(3,8),rep(0,50),
rep(1,20),rep(1,40),rep(2,30))
narrowcase=c(rep(1,40+10+6+30+14+8),rep(0,50+20+40+30))
case.exposed=c(rep(0,40+10+6),rep(1,30+14+8),rep(0,50+20),rep(1,40+30))
size.matched.set=c(rep(3,40+10+6+30+14+8),rep(2,50+20+40+30))
adaptive.case.test(no.exposed.in.matched.set,narrowcase,case.exposed,size.matched.set,Gamma=1.2,
alpha=.05)

Adaptive test for observational studies that adapts between Noether's and Brown's test statistics

Description

Sensitivity analysis for a matched pair cohort study that rejects the null hypothesis of no treatment effect if either Brown's statistic or Noether's statistic is greater than respective critical values.

Usage

adaptive.noether.brown(y,Gamma,alpha=.05,lambda1=1/3,lambda2=2/3)

Arguments

y

Vector which gives matched pair differences between treated and control unit response in each matched pair

Gamma

The value of the sensitivity analysis parameter Gamma for which the test will be conducted.

alpha

The significance level at which the test is conducted (default = .05)

lambda1

The lambda1 parameter for defining Brown's and Noether's test statistics. See details.

lambda2

The lambda2 parameter for defining Brown's and Noether's test statistics. See details.

Details

Let 0<=lambda1<=lambda2<=1. Let B1 be the number of pairs for whom the treated unit in the pair has a greater outcome than the control unit and rank among the I pairs of the absolute value of the difference between the treated and control unit's outcomes is greater than or equal to (1 - lambda1)I, where I is the number of pairs, Also, let B2 be the number of pairs for whom the treated unit in the pair has a greater outcome than the control unit and the rank of the absolute value of the difference between the treated and control unit's outcomes is is less than or equal to (1-lambda1)I but greater than or equal to (1 - lambda2)I. Noether (1973) proposed B1 as a test statistic, and Brown (1981) (and also Markowski and Hettmansperger (1982)) proposed T = 2B1 + B2 as a test statistic. The adaptive test combines these two test statistics. See Rosenbaum (2012) for the details.

Value

alpha

Significance level at which the test is conducted.

Gamma

The value of the sensitivity parameter Gamma at which the test of the null hypothesis of no treatment effect is conducted.

testinfomat

Matrix with information about the test. The first column lists the critical values for Noether's and Brown's test statistics. The second column lists the observed values of these two test statsitics. The null hypothesis is rejected if the observed value of either test statistic is greater than its critical value.

overall.test.result

"Accept H0" or "Reject H0" according to whether the null hypothesis of no treatment effect can be rejected for sensitivity parameter Gamma.

References

Rosenbaum, P.R. (2012). "An Exact Adaptive Test with Superior Design Sensitivity in an Observational Study of Treatments for Ovarian Cancer." Annals of Applied Statistics, 6, 83-105.

Examples

# Data on volume of hippocampus in 15 sets of twins in which one twin is affected by schizophrenia
# and one twin is not (data from R.L. Suddath et al., "Anatomical Abnormalities in the Brains of 
# Monozygotic Twins Discordant for Schizophrenia," New England Journal of Medicine 322, 1990
# pp. 789-93.  Data taken from the Statistical Sleuth, F.L. Ramsey and D.W. Schafer
unaffected=c(1.94,1.44,1.56,1.58,2.06,1.66,1.75,1.77,1.78,1.92,1.25,1.93,2.04,1.62,2.08)
affected=c(1.27,16.3,1.47,1.39,1.93,1.26,1.71,1.67,1.28,1.85,1.02,1.34,2.02,1.59,1.97)
difference=unaffected-affected
adaptive.noether.brown(difference,Gamma=1.1)
# The null hypothesis of no treatment is rejected for Gamma=1.13 but not for Gamma=1.14

Critical values for adaptive test

Description

This is an internal function which takes in a matrix that contains the error probabilities for different values of the test statistics T1.doublebar and T.doublebar and finds the pair of critical values (k1,k) for T1.doublebar and T.doublebar which satisfy the following: (i) have a Type I error rate of at most alpha; (ii) among pairs of critical values that cannot be improved, the critical values are most equitable, dividing the chance of false rejection as equally as possible between the events T1.doublebar>=k1 and T.doublebar>=k.

Usage

adaptive.test.critical.value.func(critmat, alpha = 0.05)

Arguments

critmat

Matrix that contains the error probabilities for different values of the test statistics T1.doublebar and T.doublebar that is produced by the function jointcrit

alpha

Significance level at which the test is conducted (alpha = 0.05).

Value

t1

Critical value k1 for the test statistic T1.doublebar

t1plust2

Critical value k for the test statistic T.doublebar

References

Small, D.S., Cheng, J., Halloran, M.E. and Rosenbaum, P.R. (2013). "Case Definition and Design Sensitivity." Journal of the American Statistical Association, 108, 1457-1468. See Section 5.1 of the paper.


Distribution of the convolution of two discrete random variables that taken on nonnegative integer values.

Description

Function finds the distribution for the convolution of two discrete random variables taking on nonnegative integer values.

Usage

gconv(g1, g2)

Arguments

g1

The probability that the first random variable takes on the values 0, 1, 2,...,maximum value.

g2

The probability that the second random variable takes on the values 0, 1, 2,..., maximum value.

Value

The probability that the convolution of the two random variables takes on the values 0, 1, 2,...,maximum value.

References

Section 2.3 of Small, D.S., Cheng, J., Halloran, M.E. and Rosenbaum, P.R. (2013). "Case Definition and Design Sensitivity." Journal of the American Statistical Association, 108, 1457-1468.

Examples

## For Gamma=3, I=3 discordant pairs and the Mantel-Haenszel statistic with d_i=1 for all i
gconv(gconv(c(1/4,3/4),c(1/4,3/4)),c(1/4,3/4))
## returns Pr(Tbar=k|m,F) for k=0,1,2,3)

Joint critical values for adaptive test

Description

Internal function. Given the probability distribution of independent test statistics T1 and T2, the function finds the joint distribution of T1, T1+T2.

Usage

jointcrit(p1, p2, alpha = 0.05)

Arguments

p1

The probability distribution of the test statistic T1 taking on values 0, 1, 2,..., maximum value

p2

The probability disribution of the test statistic T2 taking on values 0, 1, 2, ..., maximum value

alpha

The significance level at which the test is conducted.

Value

Matrix which contains for each possible value of t1 and t2, information about the probability of T1>=t1, T1+T2>=t1+t2.


Distribution of Mantel-Haenszel test statistic.

Description

Internal function that computes the distribution of m*Mantel-Haenszel statistic for sensitivity parameter Gamma.

Usage

mhxct.weighted(mi, Ji, gamma = 1, m = 1)

Arguments

mi

Number of exposed subjects in each matched set.

Ji

Number of subjects in each matched set.

gamma

Sensitivity parameter.

m

Factor by which Mantel-Haenszel statistic should be multiplied (default is 1).

Value

Upper bound on the probability that m*Mantel-Haenszel statistic equals 0, 1,,...maximum value when the null hypothesis of no treatment effect is true and the sensitivity parameter is Gamma.


Sensitivity analysis for aberrant rank test.

Description

This function carries out sensitivity analysis for the aberrant rank test for matched case-control studies.

Usage

sens.analysis.aberrant.rank(cases.exposed,referents.exposed,case.rank,no.referents,Gamma)

Arguments

cases.exposed

Vector which contains the number of cases exposed in each matched set.

referents.exposed

Vector which contains the number of referents (controls) exposed in each matched set.

case.rank

Vector which contains the rank of the cases' extremeness of disease, where 1 corresponds to the least extreme disease and I=number of matched sets corresponds to the most extreme disease.

no.referents

Vector which contains the number of referents (controls) in each matched set.

Gamma

The sensitivity parameter Gamma at which the test is conducted.

Details

The test being conducted is of the null hypothesis of no treatment effect vs. a one-sided alternative that exposure to the treatment increases the outcome. The function outputs the lower and upper bounds on the p-values for testing the null hypothesis for all distributions of treatment assignments that are consistent with the sensitivity parameter Gamma. The test is rejected if the upper bound on the p-value is less than alpha. The sensitivity parameter Gamma is the maximum amount by which two subjects matched for observed covariates may differ in their odds of exposure to the treatment. The test statistic is the sum of the aberrant ranks of the cases in the matched sets where the case is exposed to treatment, where the aberrant ranks are the ranks of the cases in extremeness of disease (1 corresponds to the least extreme disease and I = number of matched sets corresponds to the most extreme disease). See Small, Cheng, Halloran and Rosenbaum (2012) for further details.

Value

lower.bound.pval

Lower bound on the p-value for all distributions of treatment assignment consistent with the sensitivity parameter Gamma.

upper.bound.pval

Upper bound on the p-value for all distributions of treatment assignment consistent with the sensitivity parameter Gamma.

References

Small, D.S., Cheng, J., Halloran, M.E. and Rosenbaum, P.R. (2013). "Case Definition and Design Sensitivity." Journal of the American Statistical Association, 108, 1457-1468.


Sensitivity Analysis for Mantel-Haenszel test

Description

Sensitivity analysis for the Mantel-Haenszel test of no treatment effect for matched case-control studies.

Usage

sens.analysis.mh(cases.exposed, referents.exposed, no.referents, Gamma)

Arguments

cases.exposed

Number of cases exposed to treatment in each matched set.

referents.exposed

Number of referents (controls) exposed to treatment in each matched set.

no.referents

Number of referents (controls) in each matched set.

Gamma

The sensitivity parameter Gamma at which the test is conducted.

Details

The test being conducted is of the null hypothesis of no treatment effect vs. a one-sided alternative that exposure to the treatment increases the outcome. The function outputs the lower and upper bounds on the p-values for testing the null hypothesis for all distributions of treatment assignments that are consistent with the sensitivity parameter Gamma. The test is rejected if the upper bound on the p-value is less than alpha. The sensitivity parameter Gamma is the maximum amount by which two subjects matched for observed covariates may differ in their odds of exposure to the treatment. The test statistic is the Mantel-Haenszel test statistic, which is the sum of cases exposed to treatment. See Small, Cheng, Halloran and Rosenbaum (2012) for further details.

Value

lower.bound.pval

Lower bound on the p-value for all distributions of treatment assignment consistent with the sensitivity parameter Gamma.

upper.bound.pval

Upper bound on the p-value for all distributions of treatment assignment consistent with the sensitivity parameter Gamma.

References

Small, D.S., Cheng, J., Halloran, M.E. and Rosenbaum, P.R. (2013). "Case Definition and Design Sensitivity." Journal of the American Statistical Association, 108, 1457-1468.

Examples

# Data from narrow cases in Table 1 of Small, Cheng and Halloran, Rosenbaum
cases.exposed=c(rep(0,174+60+14+4+0),rep(1,34+19+6+1+0));
referents.exposed=c(rep(0,174),rep(1,60),rep(2,14),rep(3,4),rep(0,34),rep(1,19),rep(2,6),rep(3,1));
no.referents=rep(4,312);
# Sensitivity analysis for Mantel-Haenszel statistic at Gamma=1.2
sens.analysis.mh(cases.exposed,referents.exposed,no.referents,Gamma=1.2);