Description Usage Arguments Details Value Author(s) References Examples
Generates a random sample from a normal mixture p*N(0,c^2)+(1-p)*N(0,1), where the densities are indicated and c is the scale contamination c>1 and p is the probability of contamination which is chosen so both distributions contribute equally to the variance. The variable is then standardized to have unit variance.
1 |
n |
Sample size. |
c |
Scale inflation parameter. |
With probability p
a normal random variable with mean 0
and standard deviation c
is generated, where
p=1/(1+c^2)), and with probability 1-p a N(0,1) random
variable is generated. The resulting variable is standardized by dividing
by √{1 - p + p*c^2}, so the variance is 1.0. For a specified
parameter c
the choice of p
given by p=1/(1+c^2))
is determined by the requirement that both distributions in the mixture
contribute equally the variance and hence this is may be regarded as the
worst case.
Vector of length n.
A.I. McLeod
Tukey, J. W. (1960). A survey of sampling from contaminated distributions. In Contributions to Probability and Statistics: Essays in Honor of Harold Hotelling, Edited by I. Olkin, S. G. Ghurye, W. Hoeffding, W. G. Madow and H. B. Mann. Stanford University Press.
1 2 3 4 5 6 7 8 9 10 11 12 13 | #there are 4 values from the contaminated distribution with this seed!
set.seed(775511)
qqnorm(harper:::rcono(100,5))
#
#Compute probability at least one value from the contaminated distribution
probAtLeastOne <- function(n, c) {
p <- 1/(1+c^2)
1-(1-p)^n
}
probAtLeastOne(100, 5)
probAtLeastOne(10, 5)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.