Simulation-class {distr}R Documentation

Class "Simulation"

Description

In an object of type Simulation data can be simulated in any distribution and size.

Objects from the Class

Objects can be created by calls of the form Simulation(filename, runs, samplesize, seed, distribution). A Simulation-object includes a filename, the number of runs, the size of the sample, the seed and the distribution of the random numbers. The slot Data stays empty until the method simulate has been used.

Slots

seed:
Object of class "list": the seed the simulation has been generated with
distribution:
Object of class "UnivariateDistribution": the distribution of the random numbers
filename:
Object of class "character": the filename the simulation shall be saved
Data:
Object of class "vectororNULL": the simulated data
runs:
Object of class "numeric": the number of runs of the data
samplesize:
Object of class "numeric": the size of the sample, so the dimension of the data

Extends

Class "Dataclass", directly.

Methods

Data<-
signature(object = "Contsimulation"): ERROR: A modification of simulated data is not allowed.
distribution
signature(object = "Simulation"): returns the distribution
distribution<-
signature(object = "Simulation"): changes the distribution
seed
signature(object = "Simulation"): returns the seed
seed<-
signature(object = "Simulation"): changes the seed
runs<-
signature(object = "Simulation"): changes the number of runs
samplesize<-
signature(object = "Simulation"): changes the size of the sample
savedata
signature(object = "Simulation"): saves the object without the data in the directory of R (After loading the data can be reproduced by using simulate.)
initialize
signature(.Object = "Simulation"): initialize method
plot
signature(x = "Simulation"): produces a plot of the data matrix
print
signature(x = "Simulation"): returns filename, seed, number of runs, the size of the sample and the distribution
simulate
signature(x = "Simulation"): generates the random numbers for the simulation
summary
signature(object = "Simulation"): returns filename, seed, number of runs, the size of the sample and a statistical summary for each run

Note

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

Author(s)

Thomas Stabla Thomas.Stabla@uni-bayreuth.de,
Florian Camphausen Florian.Camphausen@uni-bayreuth.de,
Peter Ruckdeschel Peter.Ruckdeschel@uni-bayreuth.de,
Matthias Kohl Matthias.Kohl@uni-bayreuth.de

See Also

Dataclass-class Contsimulation-class plot-methods print-methods summary-methods simulate-methods

Examples

N=Norm() # N is a standard normal distribution.
S=Simulation(filename="xyz",runs=10,samplesize=3,seed=setRNG(),distribution=N)
Data(S) # no data yet
simulate(S)
Data(S) # now there are random numbers
Data(S) # the same data as before because the seed has not changed
seed(S)=setRNG()
simulate(S)
Data(S) # different data
savedata(S) # saves the object in the directory of R...
load("xyz") # loads it again...
Data(S) # ...without the data - use simulate to return it!

[Package Contents]