Contsimulation-class {distrSim}R Documentation

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 from a contaminating distribution.

Objects from the Class

Objects can be created by calls of the form Contsimulation(filename, samplesize, runs, seed, distribution.id, distribution.c, rate) (observation dimension is deduced from slot distribution.id). 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. The same goes for slots Data.id and Data.c.

Slots

ind:
Object of class "MatrixorNULLorVector": Indicator of the same length as the data; saves whether each element of the data vector is contaminated or not
Data.id:
Object of class "ArrayorNULLorVector": – the ideal data
Data.c:
Object of class "ArrayorNULLorVector": – the contaminated data
rate:
Object of class "numeric": the contamination rate, so the probability for each random number to be contaminated
distribution.c:
Object of class "UnivariateDistribution": the distribution of the ideal data
distribution.id:
Object of class "UnivariateDistribution": the distribution of the contaminated data
seed:
Object of class "list": the seed the simulation has been generated with
name:
Object of class "character": a name for the Contsimulation
filename:
Object of class "character": the filename the Contsimulation shall be saved
Data:
Object of class "ArrayorNULLorVector": the simulated data
samplesize:
Object of class "numeric": the size of the sample, so the dimension of the data
obsDim:
Object of class "numeric": the observation dimension of the data
runs:
Object of class "numeric": the number of runs of the data

Extends

Class "Dataclass", directly.

Methods

Data.c
signature(object = "Contsimulation"): returns the contaminated data
Data.id
signature(object = "Contsimulation"): returns the ideal data
Data<-
signature(object = "Contsimulation"): ERROR: A modification of simulated data is not allowed.
filename
signature(object = "Contsimulation"): returns the the filename
filename<-
signature(object = "Contsimulation"): changes the the filename
name
signature(object = "Contsimulation"): returns the the name
name<-
signature(object = "Contsimulation"): changes the the name
distribution.c
signature(object = "Contsimulation"): returns the distribution of the contaminated data
distribution.c<-
signature(object = "Contsimulation"): changes the distribution of the contaminated data
distribution.id
signature(object = "Contsimulation"): returns the distribution of the ideal data
distribution.id<-
signature(object = "Contsimulation"): changes the distribution of the ideal data
seed
signature(object = "Contsimulation"): returns the seed
seed<-
signature(object = "Contsimulation"): changes the seed
ind
signature(object = "Contsimulation"): returns the indicator which saves which data is contaminated
initialize
signature(.Object = "Contsimulation"): initialize method
rate
signature(object = "Contsimulation"): returns the contamination rate
rate<-
signature(object = "Contsimulation"): changes the contamination rate
obsDim
signature(object = "Contsimulation"): returns the dimension of the observations
getVersion
signature(object = "Contsimulation"): returns the version of this package, under which this object was generated
runs
signature(object = "Contsimulation"): returns the number of runs
runs<-
signature(object = "Contsimulation"): changes the number of runs
samplesize
signature(object = "Contsimulation"): returns the size of the sample
samplesize<-
signature(object = "Contsimulation"): changes the size of the sample
savedata
signature(object = "Contsimulation"): saves the object without the data in the directory of R. (After loading the data can be reproduced by using simulate.)
simulate
signature(x = "Contsimulation"): generates the random numbers for the simulation
plot
signature(x = "Contsimulation"): produces a plot of the real data matrix; ; for details confer plot-methods
print
signature(x = "Contsimulation"): returns filename, seed, the observation dimension, the number of runs, the size of the sample, the contamination rate and the distributions, and, if from a version > 1.8, also the package version under which the object was generated
summary
signature(object = "Contsimulation"): returns filename, seed, number of runs, the size of the sample, the rate and a statistical summary for each run of the real data

Note

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

Author(s)

Thomas Stabla statho3@web.de,
Florian Camphausen fcampi@gmx.de,
Peter Ruckdeschel Peter.Ruckdeschel@itwm.fraunhofer.de,
Matthias Kohl Matthias.Kohl@stamats.de

See Also

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

Examples

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
Data(cs)
Data.id(cs)
Data.c(cs)
ind(cs)
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!

[Package distrSim version 2.0.4 Index]