new_model | R Documentation |
Creates a new Model
object.
new_model(name, label, params = list(), simulate)
name |
a short name identifier. Must be alphanumeric (though -, _, and / are allowed as long as they are not at the start or end of name. |
label |
a longer, human readable label that can have other characters such as spaces, hyphens, etc. |
params |
a list that contains the Model object's parameters |
simulate |
a function that has arguments |
make_my_example_model <- function(n) { new_model(name = "normal-data", label = sprintf("Normal (n = %s)", n), params = list(n = n, mu = 2), simulate = function(n, mu, nsim) { # this function must return a list of length nsim x <- matrix(rnorm(n * nsim), n, nsim) x <- mu + x # true mean is mu return(split(x, col(x))) # make each col its own list element }) }
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.