Learn R Programming

metRology (version 0.9-16.1)

.pmsd.xnorm: Internal functions for package RKC.

Description

The following functions are used internally by pmsd and qmsd.

Usage

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

Arguments

q
vector of quantiles
x
scalar value
n
number of observations in data set to which msd is applied
sd
a standard deviation
sd
Standard deviation, used to scale q.
scale
If scale is TRUE, sd is divided by sqrt(2).

Value

  • A vector of probabilities

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.

References

Mood, Graybill and Boes (1974) pp252ff

See Also

pmsd, msd

Examples

Run this code
## 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)

  }

Run the code above in your browser using DataLab