distr (version 1.4)

Contsimulation-class: Class "Contsimulation"

Description

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.

Arguments

Objects from the Class

Objects can be created by calls of the form Contsimulation(filename, runs, samplesize, seed, distribution.id, 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.

Extends

Class "Dataclass", directly.

See Also

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

Examples

Run this code
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(),
                     distribution.id = N,
                     distribution.c = C,
                     rate = 0.1)
simulate(cs)
# Each of the 30 random numbers is ideal (N-distributed) with
# probability 0.9 and contaminated (C-distributed) with
# probability = 0.1
summary(cs)
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!

Run the code above in your browser using DataCamp Workspace