Skip to content

Commit

Permalink
For #126 - change bottleneck size from a fixed value to one drawn fro…
Browse files Browse the repository at this point in the history
…m a distribution
  • Loading branch information
wychao2 committed Sep 18, 2020
1 parent ae05f46 commit 90e8907
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion R/simInnerTree.R
Original file line number Diff line number Diff line change
Expand Up @@ -233,15 +233,17 @@ sim.inner.tree <- function(run) {
#'
#' @return list of Lineage objects to pass to source Compartment
#' @keywords internal
#' @import countreg
.resolve.bottleneck <- function(run, comp) {

time <- comp$get.branching.time()
if (!is.numeric(time)) {
stop("Error in .resolve.bottleneck: Compartment ", comp$get.name(),
" has no assigned branching time.")
}
mean.size <- comp$get.type()$get.bottleneck.size()

bottleneck.size <- comp$get.type()$get.bottleneck.size()
bottleneck.size <- countreg::rztnbinom(1, mean.size, 1)
if (!is.numeric(bottleneck.size)) {
stop("Error in .resolve.bottleneck: Compartment ", comp$get.name(),
" has no bottleneck size specified.")
Expand Down

1 comment on commit 90e8907

@ArtPoon
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I made some further changes so that user can specify different amounts of overdispersion.
YAML has to include bottleneck.theta of some value > 0. If it is missing then program defaults to no variation in bottleneck size.

Please sign in to comment.