repeater: Repeated simulation

Description Usage Arguments See Also Examples

View source: R/simulater.R

Description

Repeated simulation

Usage

1
2
repeater(dataset, nr = 12, vars = "", grid = "", sum_vars = "",
  byvar = "sim", fun = "sum", form = "", seed = NULL, name = "")

Arguments

dataset

Return value from the simulater function

nr

Number times to repeat the simulation

vars

Variables to use in repeated simulation

grid

Character vector of expressions 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 character vector with the formula to apply to the summarized data

seed

Seed for the repeated simulation

name

Deprecated argument

See Also

summary.repeater to summarize results from repeated simulation

plot.repeater to plot results from repeated simulation

Examples

 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
simdat <- simulater(
  const = c("var_cost 5","fixed_cost 1000"),
  norm = "E 0 100;",
  discrete = "price 6 8 .3 .7;",
  form = c(
    "demand = 1000 - 50*price + E",
    "profit = demand*(price-var_cost) - fixed_cost",
    "profit_small = profit < 100"
  ),
  seed = 1234
)

repdat <- repeater(
  simdat,
  nr = 12,
  vars = c("E","price"),
  sum_vars = "profit",
  byvar = "sim",
  form = "profit_365 = profit < 36500",
  seed = 1234,
)

head(repdat)
summary(repdat)
plot(repdat)

radiant-rstats/radiant.model documentation built on Nov. 13, 2018, 7 a.m.