Contsimulation-class | R Documentation |
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 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.
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
Class "Dataclass"
, directly.
signature(object = "Contsimulation")
: returns the contaminated data
signature(object = "Contsimulation")
: returns the ideal data
signature(object = "Contsimulation")
: ERROR: A modification of simulated data is not allowed.
signature(object = "Contsimulation")
: returns the the filename
signature(object = "Contsimulation")
: changes the the filename
signature(object = "Contsimulation")
: returns the the name
signature(object = "Contsimulation")
: changes the the name
signature(object = "Contsimulation")
: returns the distribution of the contaminated data
signature(object = "Contsimulation")
: changes the distribution of the contaminated data
signature(object = "Contsimulation")
: returns the distribution of the ideal data
signature(object = "Contsimulation")
: changes the distribution of the ideal data
signature(object = "Contsimulation")
: returns the seed
signature(object = "Contsimulation")
: changes the seed
signature(object = "Contsimulation")
: returns the indicator which saves which data is contaminated
signature(.Object = "Contsimulation")
: initialize method
signature(object = "Contsimulation")
: returns the contamination rate
signature(object = "Contsimulation")
: changes the contamination rate
signature(object = "Contsimulation")
: returns the dimension of the observations
signature(object = "Contsimulation")
: returns the version of this package, under which this object was generated
signature(object = "Contsimulation")
: returns the number of runs
signature(object = "Contsimulation")
: changes the number of runs
signature(object = "Contsimulation")
: returns the size of the sample
signature(object = "Contsimulation")
: changes the size of the sample
signature(object = "Contsimulation")
: saves the object without the data in the
directory of R. (After loading the data can be reproduced by using simulate.)
signature(x = "Contsimulation")
: generates the random numbers for the simulation
signature(x = "Contsimulation")
: produces a plot of the real data matrix; ; for details confer plot-methods
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
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
Changing distributions, seed, runs, samplesize or rate deletes possibly simulated data, as it would not fit to the new parameters.
Thomas Stabla statho3@web.de,
Florian Camphausen fcampi@gmx.de,
Peter Ruckdeschel peter.ruckdeschel@uni-oldenburg.de,
Matthias Kohl Matthias.Kohl@stamats.de
Dataclass-class
Simulation-class
savedata-methods
plot-methods
simulate-methods
summary-methods
getVersion-methods
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!
## clean up
unlink("csim")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.