repeater: Repeated simulation

repeaterR Documentation

Repeated simulation

Description

Repeated simulation

Usage

repeater(
  dataset,
  nr = 12,
  vars = "",
  grid = "",
  sum_vars = "",
  byvar = ".sim",
  fun = "sum",
  form = "",
  seed = NULL,
  name = "",
  envir = parent.frame()
)

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

envir

Environment to extract data from

See Also

summary.repeater to summarize results from repeated simulation

plot.repeater to plot results from repeated simulation

Examples

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_sum < 36500",
  seed = 1234,
)

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


radiant-rstats/radiant.model documentation built on Nov. 29, 2023, 5:59 a.m.