Last chance! 50% off unlimited learning
Sale ends in
Performs a Friedman rank sum test. The null hypothesis
H
friedmanTest(y, ...)# S3 method for default
friedmanTest(y, groups, blocks, dist = c("Chisquare", "FDist"), ...)
a numeric vector of data values, or a list of numeric data vectors.
a vector or factor object giving the group for the
corresponding elements of "x"
. Ignored with a warning if "x"
is a list.
a vector or factor object giving the block for the
corresponding elements of "x"
.
Ignored with a warning if "x"
is a list.
the test distribution. Defaults to Chisquare
.
further arguments to be passed to or from methods.
A list with class "htest"
containing the following components:
a character string indicating what type of test was performed.
a character string giving the name(s) of the data.
the estimated quantile of the test statistic.
the p-value for the test.
the parameters of the test statistic, if any.
a character string describing the alternative hypothesis.
the estimates, if any.
the estimate under the null hypothesis, if any.
The function has implemented Friedman's test as well as
the extension of Conover anf Iman (1981). Friedman's
test statistic is assymptotically chi-squared distributed.
Consequently, the default test distribution is dist = "Chisquare"
.
If dist = "FDist"
is selected, than the approach of
Conover and Imam (1981) is performed.
The Friedman Test using the
Conover, W.J., Iman, R.L. (1981) Rank Transformations as a Bridge Between Parametric and Nonparametric Statistics. Am Stat 35, 124--129.
Sachs, L. (1997) Angewandte Statistik. Berlin: Springer.
# NOT RUN {
## Hollander & Wolfe (1973), p. 140ff.
## Comparison of three methods ("round out", "narrow angle", and
## "wide angle") for rounding first base. For each of 18 players
## and the three method, the average time of two runs from a point on
## the first base line 35ft from home plate to a point 15ft short of
## second base is recorded.
RoundingTimes <-
matrix(c(5.40, 5.50, 5.55,
5.85, 5.70, 5.75,
5.20, 5.60, 5.50,
5.55, 5.50, 5.40,
5.90, 5.85, 5.70,
5.45, 5.55, 5.60,
5.40, 5.40, 5.35,
5.45, 5.50, 5.35,
5.25, 5.15, 5.00,
5.85, 5.80, 5.70,
5.25, 5.20, 5.10,
5.65, 5.55, 5.45,
5.60, 5.35, 5.45,
5.05, 5.00, 4.95,
5.50, 5.50, 5.40,
5.45, 5.55, 5.50,
5.55, 5.55, 5.35,
5.45, 5.50, 5.55,
5.50, 5.45, 5.25,
5.65, 5.60, 5.40,
5.70, 5.65, 5.55,
6.30, 6.30, 6.25),
nrow = 22,
byrow = TRUE,
dimnames = list(1 : 22,
c("Round Out", "Narrow Angle", "Wide Angle")))
## Chisquare distribution
friedmanTest(RoundingTimes)
## check with friedman.test from R stats
friedman.test(RoundingTimes)
## F-distribution
friedmanTest(RoundingTimes, dist = "FDist")
## Check with One-way repeated measure ANOVA
rmat <- RoundingTimes
for (i in 1:length(RoundingTimes[,1])) rmat[i,] <- rank(rmat[i,])
dataf <- data.frame(
y = y <- as.vector(rmat),
g = g <- factor(c(col(RoundingTimes))),
b = b <- factor(c(row(RoundingTimes))))
summary(aov(y ~ g + Error(b), data = dataf))
# }
Run the code above in your browser using DataLab