pmsd.xnorm: Internal functions for package RKC.

Description Usage Arguments Details Value Author(s) References See Also Examples

Description

The following functions are used internally by pmsd and qmsd.

Usage

1
.pmsd.xnorm(q, x, n, sd = 1, scale = FALSE, method="exact")

Arguments

q

vector of quantiles

x

scalar value

n

number of observations in data set to which msd is applied

sd

Standard deviation, used to scale q.

scale

If scale is TRUE, sd is divided by sqrt(2).

method

Controls method of calculation; see pmsd for details.

Details

Provides the distribution function for msd given a value x, using the cumulative probability for an order statistics givn in Mood, Graybill and Boes (1974) pp252ff. pmsd integrates (using integrate) over x to obtain the distribution function for msd for random x.

Value

A vector of probabilities

Author(s)

S Ellison s.ellison@lgc.co.uk

References

Mood, Graybill and Boes (1974) pp252ff

See Also

pmsd, msd

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
## The function is currently defined as
function(q, x, n, sd=1, scale=FALSE) {

if(scale) sd <- sd/sqrt(2)

pxnorm<-function(q,x,sd=1) ifelse(q>0, pnorm(x+q, 0, sd)-pnorm(x-q, 0, sd), 0) 

Fy<-rep(0, length(q))

n.med<-floor(n/2) #exact for odd samples, low for even
#Note that for n values there are n-1 differences,
#so an even-n case is an odd-median case
ph<-pxnorm(q,x,sd)

for(j in n.med:(n-1)) Fy <- Fy + choose(n-1,j) * (ph^j) * (1-ph)^(n-j-1)

return(Fy)

  }

metRology documentation built on Sept. 22, 2020, 3 a.m.