library(parallel)
library(data.table)
library(ggplot2)
############################################################
### Debugging and exploring the linear regression model ###
############################################################
# Does separate runs produce differing predictions?
regtest <- mclapply(
rep(1, 4),
bikes_regression,
agc = list(1, 600, FALSE),
mc.cores = 4
)
all_regs <- rbindlist(regtest, idcol = "run")
head(all_regs)
saveRDS(all_regs, "temp-bikes/agents/all_regs.Rds")
# In case something goes horribly wrong
all_regs$run <- as.factor(all_regs$run)
all_regs[all_regs$t == 667, "lpdens"] <- 0
ggplot(all_regs, aes(x = t, y = lpdens, col = run)) +
geom_line() +
labs(title = "Lpdens of multiple runs of Bayesian linear regression")
ggsave("temp-bikes/agents/compare_linreg.pdf")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.