Skip to content

Instantly share code, notes, and snippets.

@mkuhn
Created September 30, 2015 09:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mkuhn/e6f7a6b94fb31f587ce2 to your computer and use it in GitHub Desktop.
Save mkuhn/e6f7a6b94fb31f587ce2 to your computer and use it in GitHub Desktop.
Detecting correlation between initial parameters and run time in RStan
library(purrr)
runtimes <- get_elapsed_time(fit)[,2]
inits <- get_inits(fit)
## traditional conversion to a matrix
# m.init <- do.call(rbind, lapply(inits, function(l) do.call(c, l)))
## using purrr
m.init <- inits %>% map(lift_dl(c)) %>% map_call(rbind)
time_cor <- cor(m.init, runtimes)
time_cor <- time_cor[ order(time_cor), ]
head(time_cor, n=25)
tail(time_cor, n=25)
# plot(m.init[,"parameter_name"], runtimes)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment