library(earlywarning)
library(snow)
library(methods)
cl <- makeCluster(20, type = "MPI")
## 20 slaves are spawned successfully. 0 failed.
clusterEvalQ(cl, library(earlywarning))
data(ibms)
A <- stability_model(ibm_critical, "OU")
B <- stability_model(ibm_critical, "LSN")
observed <- -2 * (logLik(A) - logLik(B))
clusterExport(cl, ls())
clusterExport(cl, list = c("A", "B"))
reps <- parLapply(cl, 1:500, function(i) compare(A, B))
lr <- lik_ratios(reps)
roc <- roc_data(lr)
save(list = ls(), file = "simulation.rda")
stopCluster(cl)
require(ggplot2)
ggplot(lr) + geom_density(aes(value, fill = simulation), alpha = 0.6) +
geom_vline(aes(xintercept = observed))
ggplot(roc) + geom_line(aes(False.positives, True.positives))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.