dummyinstance {CAISEr}R Documentation

Dummy instance routine to test the sampling procedures

Description

This is a dummy instance routine to test the sampling procedures, in combination with dummyalgo(). dummyinstance() receives a parameter distr containing the name of a random number generation function (e.g. rnorm, runif, rexp etc.), plus a variable number of arguments to be passed down to the function in distr.

Usage

dummyinstance(distr, ..., bias = 0)

Arguments

distr

name of a function that generates random values according to a given distribution, e.g., "rnorm", "runif", "rexp" etc.

...

additional parameters to be passed down to the function in distr. Parameter n (number of points to generate) is unnecessary (this routine always forces n = 1).

bias

a bias term to add to the results of the distribution function (e.g., to set the mean to zero).

Value

a single numeric value sampled from the desired distribution.

Author(s)

Felipe Campelo (fcampelo@ufmg.br, f.campelo@aston.ac.uk)

See Also

dummyalgo()

Examples

dummyinstance(distr = "rnorm", mean = 10, sd = 1)

# Make a centered (zero-mean) exponential distribution:
lambda = 4

# 10000 observations
set.seed(1234)
y <- numeric(10000)
for (i in 1:10000) y[i] <- dummyinstance(distr = "rexp", rate = lambda,
                                         bias = -1/lambda)
mean(y)
hist(y, breaks = 50, xlim = c(-0.5, 2.5))

[Package CAISEr version 1.0.17 Index]