| srh.kway | R Documentation |
Generalizes the Scheirer–Ray–Hare (SRH) approach to k-factor designs
by using Type II sums of squares from a linear model on ranks, with a
standard tie correction D applied to p-values. The function returns
H, tie-corrected H (Hadj), p-values and rank-based effect sizes
(eta2H, eps2H) for each main effect and interaction up to the
full order (i.e., (A + B + ...)^k).
srh.kway(formula, data, clamp0 = TRUE, force_factors = TRUE, ...)
formula |
A formula of the form |
data |
A |
clamp0 |
Logical; if |
force_factors |
Logical; coerce grouping variables to |
... |
Passed to |
Ranks are computed globally on y (ties.method = "average").
Type II sums of squares are obtained from car::Anova(fit, type = 2) on
the rank model R ~ (A + B + ...)^k. The tie correction is
D = 1 - \frac{\sum (t^3 - t)}{n^3 - n},
where t are tie block sizes and n is the number of complete
cases. We report Hadj = H / D and p = P(\chi^2_{df} \ge Hadj).
Rank-based effect sizes are computed from the uncorrected H
(classical SRH convention):
eta2H = (H - k + 1) / (n - k), where k is the number of
groups compared by the term (for interactions, the number of observed
combinations),
eps2H = H * (n + 1) / (n^2 - 1) (KW-like epsilon squared).
A data.frame with class c("srh_kway","anova","data.frame")
containing columns: Effect, Df, Sum Sq, H,
Hadj, p.chisq, k, n, eta2H, eps2H.
The original call is attached as an attribute and can be retrieved with
getCall().
data(mimicry, package = "factorH")
# One factor (KW-style check)
srh.kway(liking ~ condition, data = mimicry)
# Two factors
srh.kway(liking ~ gender + condition, data = mimicry)
# Three factors
srh.kway(liking ~ gender + condition + age_cat, data = mimicry)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.