Friedman: Friedman's chi-square

FriedmanR Documentation

Friedman's chi-square

Description

Density, distribution function, quantile function, random generator and summary function for Friedman's chi square.

Usage

dFriedman(x, r, N, log=FALSE)
pFriedman(q, r, N, lower.tail=TRUE, log.p=FALSE)
qFriedman(p, r, N, lower.tail=TRUE, log.p=FALSE)
rFriedman(n, r, N)
sFriedman(r, N)

Arguments

x, q

vector of non-negative quantities

p

vector of probabilities

n

number of values to generate. If n is a vector, length(n) values will be generated

r

vector of number of treatments

N

(N >= 2) vector of number of replications of each treatment

log, log.p

logical vector; if TRUE, probabilities p are given as log(p)

lower.tail

logical vector; if TRUE (default), probabilities are P[X <= x], otherwise, P[X > x]

Details

The Freidman chi-squared is used for nonparametric ANOVA. The data in N rows of an N \times r table are ranked separately such that the ranks take the values from 1 to r in the N different rows. The distributions are obtained on the assumption that there is no relationship between the N rows.

Formulae:

Let R_j be the sum of ranks for treatment j (j=1\dots r), then the Friedman statistic is

x=\frac{12}{N r (r+1)}\sum_{j=1}^{r}R_j^2 -3N(r+1)

this is asymptotically equivalent to a \chi^2 random variable. One may also calculate the chi squared statistic for the usual analysis of variance which gives

F=\frac{(N-1)x}{N(r-1)-x}

which may be used with the F distribution functions in R for degrees of freedom (r-1) and (N-1)(r-1).

Value

The output values conform to the output from other such functions in R. dFriedman() gives the density, pFriedman() the distribution function and qFriedman() its inverse. rFriedman() generates random numbers. sFriedman() produces a list containing parameters corresponding to the arguments – mean, median, mode, variance, sd, third cental moment, fourth central moment, Pearson's skewness, skewness, and kurtosis.

Note

Exact calculations are made for the following values of the parameters:

r N
2 100
3 30
4 15
5 8

These exact calculations are made using the algorithm of Kendall and Smith (1939).

The incomplete beta, with continuity correction, is used for calculations outside these ranges. Some appreciation for the accuracy of the approximation may be obtained by comparing the calculated values with exact tables such as Odeh (1977). Iman and Davenport (1980) have studied the accuracy of various approximations.

Author(s)

Bob Wheeler

References

Kendall, M. and Smith, B.B. (1939). The problem of m rankings. Ann. Math. Stat. 10. 275-287.

Iman, R.L. and Davenport, J.M. (1980). Approximations of the critical region of the Friedman statistic. Comm. Stat. Theor. Meth. A9(6). 571-595.

Odeh, R.E. (1977). Extended tables of the distribution of Friedman's S-statistic in the two-way layout. Commun. Statist.-Simula. Computa. B6(1). 29-48.

Examples


pFriedman(2, r=5, N=10)
pFriedman(c(.8,3.5,9.3), r=5, N=10) ## approximately 5% 50% and 95%
sFriedman(r=5, N=10)
plot(function(x)dFriedman(x, r=5, N=10),0,10)



SuppDists documentation built on Sept. 11, 2024, 6:58 p.m.