dFriedman: Friedman's chi-square

Description Usage Arguments Details Value Note Author(s) References Examples

Description

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

Usage

1
2
3
4
5
6
7
8
9
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

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]

p

vector of probabilities

n

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

Details

The Friedman chi-squared is used for nonparametric ANOVA. The data in N rows of an N x 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 Rj be the sum of ranks for treatment j (j=1 … r), then the Friedman statistic is

x=[12/(N r (r+1))]Sum(1 … r)(Rj^2) - 3 N (r+1)

x=[12/(N r (r+1))]Sum(1 … r)(Rj^2) - 3 N (r+1)

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

F=((N-1) x)/(N (r-1)-x)

F=((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 Friedman() 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 [email protected]

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

1
2
3
4
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)

andrie/SuppDists documentation built on May 10, 2019, 11:18 a.m.