SimControl {simFrame}R Documentation

Create objects of class "SimControl"

Description

Create objects of class "SimControl".

Usage

SimControl(...)

Arguments

... arguments passed to new("SimControl", ...).

Value

An object of class "SimControl".

Author(s)

Andreas Alfons, alfons@statistik.tuwien.ac.at

See Also

SimControl

Examples

## for reproducibility
set.seed(1234)

## function for generating data
grnorm <- 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.5)
dc <- DataControl(size = 500, distribution = grnorm, 
    dots = list(means = means))
cc <- DCARContControl(target = "value", 
    epsilon = 0.1, dots = list(mean = 10))

## function for simulation runs
sim <- function(x) {
    c(mean = mean(x$value), 
        trimmed = mean(x$value, trim = 0.1), 
        median = median(x$value))
}

## combine these to "SimControl" object and run simulation
sc <- SimControl(contControl = cc, design = "group", fun = sim)
results <- runSimulation(dc, nrep = 50, control = sc)

## plot results
plot(results, true = means)

[Package simFrame version 0.1.1 Index]