Learn R Programming

SuppDists (version 1.1-9.8)

NormalScore: Normal Scores distribution

Description

Density, distribution function, quantile function, random generator and summary function for the normal scores test. A function to calculate expected values of normal order statistics is included.

Usage

dNormScore(x, c, N, U, log=FALSE)
pNormScore(q, c, N, U, lower.tail=TRUE, log.p=FALSE)
qNormScore(p, c, N, U, lower.tail=TRUE, log.p=FALSE)
rNormScore(n, c, N, U)
sNormScore(c, N, U)
normOrder(N)

Value

The output values conform to the output from other such functions in R. dNormScore() gives the density, pNormScore() the distribution function and qNormScore() its inverse. rNormScore() generates random numbers. sNormScore() 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. normOrder() gives the expected values of the normal order statistics for a sample of size 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

c

vector number of treatments

N

vector total number of observations

U

vector sum of reciprocals of the number of the c sample sizes

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]\)

Author

Bob Wheeler

Details

This is the Kruskal-Wallis statistic with ranks replaced by the expected values of normal order statistics. There are c treatments with sample sizes \(n_j, j=1 \dots c\). The total sample size is \(N=\sum_1^c n_j\). The distribution depends on c, N, and U, where \(U=\sum_1^c (1/n_j)\).

Let \(e_N(k)\) be the expected value of the \(k_{th}\) smallest observation in a sample of N independent normal variates. Rank all observations together, and let \(R_{ij}\) denote the rank of observation \(X_{ij}\), \(i=1 \dots n_j\) for treatment \(j=1 \dots c\), then the normal scores test statistic is

$$x=(N-1)\frac{1}{\sum_{k=1}^{N} e_N(k)^2} \sum_{j=1}^{c}\frac{S_j^2}{n_j}$$

where \(S_j=\sum_{i=1}^{n_j}(e_N(R_{ij}))\).

See Lu and Smith (1979) for a thorough discussion and some exact tables for small r and n. The calculations made here use an incomplete beta approximation -- the same one used for Kruskal-Wallis, only differing in the calculation of the variance of the statistic.

The expected values of the normal order statistics use a modification of M.Maechler's C version of the Fortran algorithm given by Royston (1982). Spot checking the values against Harter (1969) confirms the accuracy to 4 decimal places as claimed by Royston.

References

Harter, H.L. (1969). Order statistics and their use in testing and estimation, volume 2. U.S. Supp. of Doc.

Lu, H.T. and Smith, P.J. (1979) Distribution of normal scores statistic for nonparametric one-way analysis of variance. Jour. Am Stat. Assoc. 74. 715-722.

Royston, J.P. (1982). Expected normal order statistics (exact and approximate) AS 177. Applied Statistics. 31. 161-165.

Examples

Run this code

#Assuming three treatments, each with a sample size of 5
pNormScore(2, 3, 15, 0.6)
pNormScore(c(0.11,1.5,5.6), 3, 15, 0.6) ## approximately 5% 50% and 95%
sNormScore(3, 15, 0.6)
plot(function(x)dNormScore(x,c=5, N=15, U=0.6),0,5)

Run the code above in your browser using DataLab