Learn R Programming

radiant.model (version 0.8.0)

repeater: Repeat simulation

Description

Repeat simulation

Usage

repeater(nr = 12, vars = "", grid = "", sum_vars = "", byvar = "sim",
  fun = "sum_rm", form = "", seed = "", name = "", sim = "")

Arguments

nr

Number times to repeat the simulation

vars

Variables to use in repeated simulation

grid

Expression to use in grid search for constants

sum_vars

(Numeric) variables to summaries

byvar

Variable(s) to group data by before summarizing

fun

Functions to use for summarizing

form

A string with the formula to apply to the summarized data

seed

To repeat a simulation with the same randomly generated values enter a number into Random seed input box.

name

To save the simulated data for further analysis specify a name in the Sim name input box. You can then investigate the simulated data by choosing the specified name from the Datasets dropdown in any of the other Data tabs.

sim

Return value from the simulater function

Examples

Run this code
# NOT RUN {
result <- simulater(const = "var_cost 5;fixed_cost 1000;", norm = "E 0 100;",
                    discrete = "price 6 8 .3 .7;",
                    form = "demand = 1000 - 50*price + E;
                            profit = demand*(price-var_cost) - fixed_cost;
                            profit_small = profit < 100",
                    seed = "1234")
repeater(nr = 12, vars = c("E","price"), sum_vars = "profit",
         byvar = "sim", form = "profit_365 = profit < 36500",
         seed = "1234", sim = result) %>% head

# }

Run the code above in your browser using DataLab