genodds: Generalized Odds Ratios

View source: R/genodds.R

genoddsR Documentation

Generalized Odds Ratios

Description

Performs Agresti's Generalized Odds Ratios (GenOR) for two-group ordinal data.

Usage

genodds(response, group, strata=NULL,
        alpha=0.05,ties="split",
        nnt=FALSE,verbose=FALSE,upper=TRUE, suppress_interpretation=FALSE,
        assume_no_effect=FALSE,
        permutation_test=FALSE, nPermutations=5000)

Arguments

response

A (non-empty) vector. Gives the outcome measure. If a factor, level order is used to determine ranking of outcomes.

group

A factor vector of equal length to response. Gives the groups for the test. Must take on exactly 2 values.

strata

An optional factor vector of equal length to response. Gives treatment blocks to separate comparisons.

alpha

The acceptable type 1 error used in the test.

ties

A string specifying how ties should be treated. Should be equal to "split" 0.5 for WMW Odds, or "drop" for Agresti's GenOR.

nnt

A boolean. If TRUE, then print number needed to treat in addition to generalised odds ratios.

verbose

A boolean. If TRUE, then print both pooled odds and relative risk ratio matrices regardless of result of statistical test.

upper

A boolean specifying if the upper triangle of relative risk ratios should be printed. If FALSE, lower triangle is used instead.

suppress_interpretation

A boolean specifying if the interpretable summary statements of results should be suppressed.

assume_no_effect

A boolean indicating if p-values and confidence intervals should be calculated using pooled_SElnnull (if TRUE) or pooled_SElnodds (if FALSE).

permutation_test

A boolean specifying if a permutation test should be performed on the data

nPermutations

The number of permutations to use in the permutation test

Details

Agresti's generalized odds ratios (GenOR) calculates the odds that, if a pair of observations are randomly selected from two groups, the outcome in one group is higher than the other. This implementation determines the direction of this comparison using factor levels. Odds are given with reference to observations corresponding to the higher group level resulting in a higher value in response. The opposite direction can be calculated by either calculating 1/genodds, or by specifying response=1-response in function input.

If nnt=TRUE, the Number Needed to Treat (NNT) is printed. NNT is a health economics measure and is related to generalised odds ratios through the formula NNT=1+2/(GenOR-1). It measures the expected number of patients required for a treatment to have impacted a patient's outcome. In this implementation, a positive NNT occurs when GenOR>1 and corresponds to the number needed to treat in the higher group level to observe a higher response value, while a negative NNT occurs when GenOR<1 and corresponds to the number needed to treat in the higher group level to observe a lower response value. If the confidence interval for GenOR straddles 1, the confidence interval for NNT is given as the union of disjoint intervals.

ties changes how ties are treated. If "split" is provided, then ties are equally split between favouring both groups (following the approach set out by O'Brien et. al. (2006)). If "drop" is provided, then ties are ignored (following the approach set out by Agresti (1980)). By default, "split" is used.

If assume_no_effect==TRUE, use O'Brien's method for calculating standard error under null for the purposes of calculating p-values and confidence intervals. If assume_no_effect==FALSE (the default option), then p-values and confidence intervals will be calculated using standard error instead.

If strata is specified, generalized odds ratios are calculated separately for each individual strata. If in-stratum odds ratios are not significantly different from each other (with significance level alpha), these odds are pooled to obtain a global odds ratio which is adjusted for strata. If in-stratum odds ratios are significantly different, a matrix containing the relative risk ratios between stratum is printed, along with Z-scores corresponding to the significance of these differences. If verbose=TRUE is supplied, both pooled odds and relative risk ratios are printed regardless of if the between-stratum odds ratios are significantly different.

Permutation testing is performed following the approach suggested by Howard et al. (2012), where the probability of a random observation from one group achieving a higher score than a patient in another group is calculated (given there is a difference between the scores), and then the group labels are randomly shuffled to guarantee the null hypothesis of no difference between groups is true. The permutation test p-value is the proportion of such permutations which result in a test statistic more extreme than what was observed on the original data, forming a two-tail test. This procedure is equivalent to that provided by Agresti's generalised odds ratio, and is implemented here for both methods of handling ties.

By default, print.genodds() will report an interpretable summary of the test statistic following a loosely modified form of the statements suggested by Howard et al. (2012). This may be suppressed by specifying suppress_interpretation=TRUE.

Options verbose, nnt, upper, and suppress_interpretation may be re-specified when using print method.

Value

A list with class "Genodds" containing the following:

pooled_lnodds

The pooled log(odds).

pooled_lnconf.int

(1-alpha)% Confidence intervals for pooled log(odds).

pooled_SElnodds

Standard error of pooled log(odds).

pooled_SElnnull

Standard error of pooled log(odds) under the null hypothesis.

pooled_p

The p-value of the test of pooled log(odds) = 1.

pooled_rel_statistic

Statistic of test that strata odds are equal.

pooled_rel_p

p-value for test that strata odds are equal.

relative_lnodds

A matrix giving the log of the ratio of odds between strata (generalised relative risk ratio).

relative_selnodds

A matrix containing the standard error of the log(relative risk ratio).

results

A list containing a summary of each strata measure.

param.record

A list containing parameters used in the test.

References

Agresti, A. (1980). Generalized odds ratios for ordinal data. Biometrics, 59-67.

O'Brien, R. G., & Castelloe, J. (2006, March). Exploiting the link between the Wilcoxon-Mann-Whitney test and a simple odds statistic. In Thirty-first Annual SAS Users Group International Conference.

Churilov, L., Arnup, S., Johns, H., Leung, T., Roberts, S., Campbell, B. C., Davis, S. M. & Donnan, G. A. (2014). An improved method for simple, assumption-free ordinal analysis of the modified Rankin Scale using generalized odds ratios. International Journal of Stroke, 9(8), 999-1005.

Howard, G., Waller, J. L., Voeks, J. H., Howard, V. J., Jauch, E. C., Lees, K. R., ... & Hess, D. C. (2012). A simple, assumption-free, and clinically interpretable approach for analysis of modified Rankin outcomes. Stroke, 43(3), 664-669.

Examples

# Use the alteplase dataset provided by package and calculate genodds
df <- alteplase
x <- genodds(df$mRS,df$treat,df$time)
x
print(x,nnt=TRUE)


genodds documentation built on June 23, 2022, 9:10 a.m.