Description Usage Arguments Details Value Author(s) References See Also Examples
The following functions are used internally by pmsd and qmsd.
1 | .pmsd.xnorm(q, x, n, sd = 1, scale = FALSE, method="exact")
|
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 |
method |
Controls method of calculation; see |
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.
A vector of probabilities
S Ellison s.ellison@lgc.co.uk
Mood, Graybill and Boes (1974) pp252ff
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)
}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.