rcono: Random sample from contaminated normal distribution

Description Usage Arguments Details Value Author(s) References Examples

Description

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.

Usage

1
rcono(n, c)

Arguments

n

Sample size.

c

Scale inflation parameter.

Details

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.

Value

Vector of length n.

Author(s)

A.I. McLeod

References

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.

Examples

 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)

                                                       

CliffordLai/harper documentation built on May 8, 2019, 1:53 p.m.