Learn R Programming

metRology (version 0.9-28-1)

Mandel-h: Mandel's h statistic.

Description

Density, distribution function, quantile function and random generation for Mandel's h statistic, a measure of relative deviation from a common mean.

Usage

dmandelh(x, g, log = FALSE)
pmandelh(q, g, lower.tail = TRUE, log.p = FALSE)
qmandelh(p, g, lower.tail = TRUE, log.p = FALSE)
rmandelh(B, g)

Arguments

x, q

vector of quantiles.

p

vector of probabilities.

g

number of means for which h is calculated.

B

Number of observations. If 'length(B) > 1', the length is taken to be the number required.

lower.tail

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

log, log.p

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

Value

dmandelh returns the density at x, pmandelh the cumulative probability, qmandelh the quantiles for probability p and rmandelh returns B random values drawn from the distribution.

Vector values of x, p, q and g are permitted, in which case the functions return vectors.

Warning

Note that rmandelh uses B and not n (as do most R random number functions) for number of random draws; this is for compatibility with the relevant functions for Mandel's k, for which n is conventionally used for the number of replicates per group. Be careful when using named parameters!

Details

Mandel's h is calculated for a particular mean value y[i] in a set of mean values y as h[i] = ( y[i] - mean(y) )/sd(y) )

The density, probabilities and quantiles can be derived from the beta distribution: (1+h*sqrt(g)/(g-1))/2 is distributed as Beta((g-2)/2, (g-2)/2).

References

None.

See Also

pmandelk

Examples

Run this code
# NOT RUN {
	#Generate the 95% and 99% quantiles for comparison with tables in 
	#ISO 5725:1996 Part 2:
	n <- 3:30
	round(qmandelh(0.975, n), 2) #95% 2-tailed

	round(qmandelh(0.995, n), 2) #99% 2-tailed
	
# }

Run the code above in your browser using DataLab