Description Usage Arguments Details Value Author(s) Examples
These functions perturb the distribution of a given random variate generator. Thus it allows to investigate the power of tests for random variate generators.
1 2 |
n |
sample size. |
rdist |
given RVG to be perturbed. |
... |
parameters for given random variate generator. |
min, max |
left and right boundary of perturbed domain. |
p |
strength of perturbation. |
pertadd
generates random variates from a mixture of
rdist
and a uniform distribution on the interval
(min
,max
). The uniform distribution is chosen with
probability p
.
pertsub
generates random variates from the rdist
but
rejects all points in the interval (min
,max
) with
probability p
.
By varying the width of uniform distribution (min
,max
)
and probability of error p
, different levels of “artificial”
error can be introduced.
Thus it allows to investigate the power of tests
for random variate generators.
A vector of random variates from the perturbed distribution is returned.
Sougata Chaudhuri sgtchaudhuri@gmail.com, Josef Leydold josef.leydold@wu.ac.at
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | ## Generating random sample with default settings
x <- pertadd(n=1000)
y <- pertsub(n=1000)
## Generating random sample, with parent distribution as exponential.
x <- pertadd(n=1000, rdist=rexp, rate=2, min=2, max=3, p=0.005)
y <- pertsub(n=1000, rdist=rexp, rate=2, min=2, max=3, p=0.005)
## Conducting chi-square test on random variates generated from function
## pertsub with parent distribution as exponential.
ft <- rvgt.ftable(n=1e4,rep=10,
rdist=function(n){pertsub(n,rdist=rexp,p=0.1)},
qdist=qexp,breaks=1001)
plot(ft)
rvgt.chisq(ft)
## Conducting chi-square test on random variates generated from function
## pertadd with parent distribution as Weibull,shape=1,scale=2.
ft <- rvgt.ftable(n=1e4,rep=10,
rdist=function(n,...){pertadd(n,rdist=rweibull,...,p=0.05)},
qdist=qweibull,shape=1,scale=2)
plot(ft)
rvgt.chisq(ft)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.