get_complex | R Documentation |
Extract complex simulation data from a simulation object
get_complex(sim, sim_uid)
sim |
A simulation object of class |
sim_uid |
The unique identifier of a single simulation replicate. This
corresponds to the |
The value of the complex simulation result data corresponding to the
supplied sim_uid
sim <- new_sim()
create_data <- function(n) {
x <- runif(n)
y <- 3 + 2*x + rnorm(n)
return(data.frame("x"=x, "y"=y))
}
sim %<>% set_levels("n"=c(10, 100, 1000))
sim %<>% set_config(num_sim=1)
sim %<>% set_script(function() {
dat <- create_data(L$n)
model <- lm(y~x, data=dat)
return (list(
"beta1_hat" = model$coefficients[[2]],
".complex" = model
))
})
sim %<>% run()
sim$results %>% print()
get_complex(sim, 1) %>% print()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.