Skip to contents

Splits the k x 2 chi-square sum n_i (p_i - p)^2 / (p (1 - p)) into the trend part b^2 sum n_i (x_i - xbar)^2 / (p (1 - p)) on 1 df (prop.trend.test) and the deviation on k - 2 df (Hedderich, Sachs & Reynarowych 2023, eqs 7.340-7.343), and gives the unpooled z = sum x_i p_i / sqrt(sum x_i^2 p_i (1 - p_i) / n_i) of eq 7.344.

Usage

catrnd(successes, totals, scores = NULL)

Arguments

successes, totals

Counts per group.

scores

Group scores, default 1..k.

Value

Named list: chi2_trend, p_trend, chi2_deviation, df_deviation, p_deviation, chi2_total, slope, z_unpooled, p_z_unpooled.

References

Cochran, W. G. (1954). Biometrics 10, 417-451. Armitage, P. (1955). Biometrics 11, 375-386.

Examples

catrnd(c(22, 16, 2), c(36, 34, 10), c(1, 0, -1))$chi2_trend
#> [1] 5.219707