Class "Contsimulation"

In an object of type Contsimulation data can be simulated in any distribution and size. One part (usually the largest) of the random numbers stems from an ideal distribution, the rest is contaminated.


Changing distributions, seed, runs, samplesize or rate deletes possibly simulated data, as it would not fit to the new parameters.

Objects from the Class

Objects can be created by calls of the form Contsimulation(filename, runs, samplesize, seed,, distribution.c, rate). A Contsimulation-object includes a filename, the number of runs, the size of the sample, the seed, the distribution of the ideal and the contaminated data and the contamination rate. The slot Data stays empty until the method simulate has been used.


Class "Dataclass", directly.

See Also

Dataclass-class Simulation-class savedata-methods plot-methods simulate-methods summary-methods

  • Contsimulation-class
  • Contsimulation
  • initialize,Contsimulation-method
N <- Norm() # N is a standard normal distribution.
C <- Cauchy() # C is a Cauchy distribution
cs <- Contsimulation(filename = "csim",
                     runs = 10,
                     samplesize = 3,
                     seed = setRNG(),
            = N,
                     distribution.c = C,
                     rate = 0.1)
# Each of the 30 random numbers is ideal (N-distributed) with
# probability 0.9 and contaminated (C-distributed) with
# probability = 0.1
Data(cs) # different data
savedata(cs) # saves the object in the working directory of R...
load("csim") # loads it again...
Data(cs) # ...without the data - use simulate to return it!
Documentation reproduced from package distr, version 1.4, License: GPL (version 2 or later)

Community examples

Looks like there are no examples yet.