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()
sim %<>% set_levels(n=c(10, 100, 1000))
create_data <- function(n) {
x <- runif(n)
y <- 3 + 2*x + rnorm(n)
return(data.frame("x"=x, "y"=y))
}
sim %<>% set_config(num_sim=2)
sim %<>% set_script(function() {
dat <- create_data(L$n)
model <- lm(y~x, data=dat)
return(list(
"beta0_hat" = model$coefficients[[1]],
"beta1_hat" = model$coefficients[[2]],
".complex" = list(
"model" = model,
"cov_mtx" = vcov(model)
)
))
})
sim %<>% run()
c5 <- get_complex(sim, sim_uid=5)
print(summary(c5$model))
print(c5$cov_mtx)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.