Step-down Cochran-Armitage trend test with consistent scoring
Source:R/stepdown_binom.R
stepDownTrendTestBinom.RdStep-down Cochran-Armitage trend test with consistent scoring
Arguments
- successes
Vector of success counts
- totals
Vector of total trials
- doses
Vector of dose levels
- scoring
Method for defining trend: "doses", "ranks", "log_doses", "equal_spaced"
- alternative
Direction of test
- rao_scott
Whether to apply Rao-Scott correction
- phi
Overdispersion parameter (if NULL, estimated from Tarone test)
- phi_method
simple or trend_adjusted description
- tarone_results
Optional results from Tarone.trend.test for phi estimation
Value
stepDownTrendBinom object with consistent scoring A list with class "stepDownTrendBinom" containing:
- method
Description of the test performed
- data.name
Description of the data
- p.value
Matrix of p-values for each step
- statistic
Matrix of test statistics for each step
- alternative
The alternative hypothesis
- doses
The dose levels used
- noec
The No Observed Effect Concentration (highest dose with no significant effect)
- loec
The Lowest Observed Effect Concentration (lowest dose with significant effect)
Details
The step-down procedure starts with all dose groups and sequentially removes the highest dose until no significant trend is detected or only two groups remain. This helps identify the lowest dose at which a significant effect occurs.
The Cochran-Armitage test is appropriate for detecting trends in binomial proportions across ordered groups. The Rao-Scott correction adjusts for potential overdispersion in binomial data, which is common in toxicological studies.
Examples
# Example with simulated data
successes <- c(20, 18, 15, 10, 5)
totals <- rep(20, 5)
doses <- c(0, 1, 2, 5, 10)
# Run step-down test with Cochran-Armitage
result <- stepDownTrendTestBinom(successes, totals, doses)
print(result)
#>
#> Step-down Cochran-Armitage test for trend (doses scoring) (doses scoring)
#>
#> data: successes out of totals at doses 0, 1, 2, 5, 10 with doses scoring
#>
#> Step-down results:
#> Doses_Included Statistic P_Value
#> Step 1 0, 1, 2, 5, 10 -5.746549 9.108323e-09
#> Step 2 0, 1, 2, 5 -4.090480 4.304814e-05
#> Step 3 0, 1, 2 -2.462659 1.379110e-02
#> Step 4 0, 1 -1.450953 1.467931e-01
#>
#> Alternative hypothesis: two.sided
#> NOEC: 1
#> LOEC: 2
# Run with Rao-Scott correction
result_rs <- stepDownTrendTestBinom(successes, totals, doses, rao_scott = TRUE)
#> Estimated phi = 8.571 using simple method with doses scoring
print(result_rs)
#>
#> Step-down Rao-Scott corrected Cochran-Armitage test for trend (doses scoring) (doses scoring)
#>
#> data: successes out of totals at doses 0, 1, 2, 5, 10 with doses scoring
#>
#> Step-down results:
#> Doses_Included Statistic P_Value
#> Step 1 0, 1, 2, 5, 10 -1.9628953 0.04965834
#> Step 2 0, 1, 2, 5 -1.3972184 0.16234791
#> Step 3 0, 1, 2 -0.8411904 0.40024125
#> Step 4 0, 1 -0.4956136 0.62016705
#>
#> Alternative hypothesis: two.sided
#> NOEC: 5
#> LOEC: 10