Repository navigation
Uncertainty tools - #76
anon-lupineuncertainty wants to merge 37 commits into
Conversation
…ange sign on parameters
…e sensitivity calculations
|
|
||
| perturb_lambda <- function(par, value) { | ||
| vpar <- pars_all | ||
| vpar[[par]] <- value | ||
| ipm_tmp <- ipm$proto_ipm | ||
| parameters(ipm_tmp) <- vpar | ||
| ker <- ipm_tmp %>% | ||
| make_ipm(iterate = FALSE) %>% | ||
| make_iter_kernel(mega_mat = mega_mat) | ||
| dominant_eigen(ker[[1]]) | ||
| } |
There was a problem hiding this comment.
small thing, but does this need to be defined within the scope of sensitivity? Or could it live outside of this function?
There was a problem hiding this comment.
This could definitely live outside of this function and be reused in uncertainty too!
| cluster <- parallel::makePSOCKcluster(cores) | ||
| on.exit(parallel::stopCluster(cluster), add = TRUE) | ||
|
|
||
| parallel::clusterEvalQ(cluster, { |
There was a problem hiding this comment.
Don't remember if parallel is considered "base R" or not, but if not, then need to add @importFrom parallel makPSOCKcluster stopCluster clusterEvalQ clusterExport to the Roxygen block above
| #' # enter_SB1, SB1_SB1, SB2_SB1, | ||
| #' # enter_SB2, SB1_SB2, SB2_SB2)" | ||
| #' | ||
| #' @importFrom dplyr bind_rows left_join rename group_by summarize join_by |
There was a problem hiding this comment.
This will probably be too much effort to be worth it, but I was trying to avoid having dependence on most tidyverse packages (except rlang because it was basically unavoidable, and purrr because I couldn't figure out my own version of flatten). If it's easy enough to alter, I'd suggest going that route, though I don't feel strongly enough about this anymore to say it's a must.
There was a problem hiding this comment.
This is definitely doable, for uncertainty and sensitivity too.
There was a problem hiding this comment.
Before you do anything with this - did you make the figures in the manuscript with the plot functions? They're beautiful! ggplot2 doesn't directly import dplyr, but chances are most folks who use this probably already have it installed.
| patchwork, | ||
| reshape2, | ||
| stringr | ||
| Depends: R (>= 3.4) |
There was a problem hiding this comment.
ggplot2 requires R>4.1, so need to bump this here
|
Closing this as discussed. Let me know when you're ready to create it from your account! |
Add uncertainty analysis of IPMs