Skip to content

Commit

Permalink
Change in bevaviour of caribouPopGrowth. Carrying capacity K is no lo…
Browse files Browse the repository at this point in the history
…nger multiplied by initial population size.

Also more bug fixing.
  • Loading branch information
Hughes authored and Hughes committed Sep 5, 2024
1 parent 269c202 commit 5b912c4
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 12 deletions.
9 changes: 4 additions & 5 deletions R/caribouPopGrowth.R
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,7 @@
#' Given default parameters, recruitment rate is lowest \eqn{(0.5\dot{X}_t)}
#' when \eqn{\dot{N}_t=1}, approaches a maximum of \eqn{\dot{X}_t} at
#' intermediate population sizes, and declines to \eqn{0.6\dot{X}_t} as the
#' population reaches carrying capacity of \eqn{k=100} times the initial
#' population size. The post-juvenile female population in the next year
#' population reaches carrying capacity of \eqn{K=50000}. The post-juvenile female population in the next year
#' includes both survivors and new recruits:
#' \eqn{\dot{N}_{t+1}=\text{min}(\dot{W}_t+\dot{J}_t,r_{max}\dot{N}_t)}.
#'
Expand All @@ -49,7 +48,7 @@
#' @param P_K Number. Recruitment multiplier at carrying capacity.
#' @param a Number. Density dependence shape parameter.
#' @param b Number. Allee effect parameter.
#' @param K Number. Carrying capacity multiplier.
#' @param K Number. Carrying capacity.
#' @param r_max Number. Maximum population growth rate.
#' @param s Number. Sex ratio.
#' @param l_R Number. Minimum recruitment.
Expand Down Expand Up @@ -105,7 +104,7 @@ caribouPopGrowth <- function(N0,
P_K = 0.6,
a = 1,
b = 4,
K = 100,
K = 50000,
r_max = 1.3,
s=0.5,
l_R=0,
Expand Down Expand Up @@ -169,7 +168,7 @@ caribouPopGrowth <- function(N0,
roundDigits=0
doBinomial=T
}
rK <- K * N0
rK <- K #* N0
}

if(a<0){
Expand Down
7 changes: 5 additions & 2 deletions R/getOutputTables.R
Original file line number Diff line number Diff line change
Expand Up @@ -65,14 +65,17 @@ getOutputTables <- function(caribouBayesDemogMod,
if (!is.element("surv", names(survInput))) {
if (sum(survInput$event, na.rm = T) > 0) {
obsSurv <- getKMSurvivalEstimates(survInput)
} else {

}else{obsSurv=data.frame()}


if(nrow(obsSurv)==0) {
if(!is.element("id",names(survInput))){
survInput$id=NA
survInput$id[!is.na(survInput$enter)]=1
}
obsSurv <- unique(subset(survInput, !is.na(survInput$id),
select = c("Year")))

obsSurv$surv <- NA
}
} else {
Expand Down
2 changes: 1 addition & 1 deletion R/runScnSet.R
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ runScnSet <- function(scns, ePars, simNational, survAnalysisMethod = "KaplanMeie
betaPriors <- getPriors(cs)
minYr <- min(oo$exData$Year)
maxYr <- max(oo$simDisturbance$Year)
out <- try(caribouBayesianPM(
out <- (caribouBayesianPM(
survData = oo$simSurvObs, ageRatio = oo$ageRatioOut,
disturbance = oo$simDisturbance,
betaPriors = betaPriors, startYear = minYr, endYear = maxYr,
Expand Down
7 changes: 3 additions & 4 deletions man/caribouPopGrowth.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 5b912c4

Please sign in to comment.