Description Usage Arguments Value Methods for function simPlot Methods for function autoplot Methods for function plot Author(s) References See Also Examples
Plot simulation results. It is thereby possible to produce box plots, density plots, as well as to plot the average results against some tuning parameter. Although a suitable plot is selected automatically depending on the structure of the results, the default behavior can be overriden.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16  ## S4 method for signature 'SimResults'
simPlot(object, data = NULL, cont = NULL,
miss = NULL, select = NULL,
method = c("box", "density", "line"),
average = c("mean", "median"), ...)
## S4 method for signature 'data.frame'
simPlot(object, mapping = attr(object, "mapping"),
facets = attr(object, "facets"),
labels = NULL, ...)
## S4 method for signature 'SimResults'
autoplot(object, ...)
## S4 method for signature 'SimResults,missing'
plot(x, y , ...)

object, x 
the simulation results to be plotted, i.e., an object of
class 
y 
not used. 
data 
an optional integer or logical index vector specifying the data configurations for which to plot simulation results. 
cont 
an optional integer or logical index vector specifying the contamination settings for which to plot simulation results. 
miss 
an optional integer or logical index vector specifying the missing data settings for which to plot simulation results. 
select 
an optional integer, character or logical vector specifying the
columns to be plotted. It must specify a subset of the 
method 
a character string specifying which plot to produce. Possible
values are 
average 
if 
mapping 
an aesthetic mapping to override the default behavior (see

facets 
a faceting formula to override the default behavior. If
supplied, 
labels 
an optional character vector specifying specifying labels for the simulation results to be used in the plot instead of the column names. 
... 
additional arguments to be passed down, eventually to the
function drawing the visual representation (see

An object of class "ggplot"
(see ggplot
).
simPlot
signature(object = "SimResults")
plot simulation results.
signature(object = "data.frame")
plot simulation
results that have been converted to a data frame via
fortify
.
autoplot
signature(object = "SimResults")
plot simulation results.
plot
signature(x = "SimResults", y = "missing")
plot simulation results.
Andreas Alfons
Alfons, A., Templ, M. and Filzmoser, P. (2010) An ObjectOriented Framework for Statistical Simulation: The R Package simFrame. Journal of Statistical Software, 37(3), 1–36. URL http://www.jstatsoft.org/v37/i03/.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60  #### designbased simulation
data("eusilcP") # load data
## control objects for sampling and contamination
sc < SampleControl(size = 100, k = 50, seed = 12345)
cc < ContControl(target = "eqIncome",
epsilon = seq(0, 0.05, by = 0.01),
fun = function(x) x * 10, type = "CAR")
## function for simulation runs
sim < function(x) {
c(mean = mean(x$eqIncome), trimmed = mean(x$eqIncome, 0.05))
}
## run simulation
results < runSimulation(eusilcP, sc, contControl = cc,
fun = sim, seed = 12345)
## plot results
tv < mean(eusilcP$eqIncome) # true population mean
# all results
plot(results) + geom_hline(yintercept=tv)
# subset
plot(results, cont = 3) + geom_hline(yintercept=tv)
#### modelbased simulation
## function for generating data
rgnorm < function(n, means) {
group < sample(1:2, n, replace=TRUE)
data.frame(group=group, value=rnorm(n) + means[group])
}
## control objects for data generation and contamination
means < c(0, 0.25)
dc < DataControl(size = 100, fun = rgnorm,
dots = list(means = means))
cc < ContControl(target = "value",
epsilon = seq(0, 0.05, by = 0.01),
dots = list(mean = 10), type = "CCAR")
## function for simulation runs
sim < function(x) {
c(mean = mean(x$value),
trimmed = mean(x$value, trim = 0.05),
median = median(x$value))
}
## run simulation
results < runSimulation(dc, nrep = 50, contControl = cc,
design = "group", fun = sim, seed = 12345)
## plot results
tv < data.frame(mean=means, group=1:2)
# all results
plot(results) + geom_hline(aes(yintercept=mean), data=tv)
# subset
plot(results, cont = 3) + geom_hline(aes(yintercept=mean), data=tv)

Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.