Skip to content

Commit

Permalink
switch to geometric mean lambda in caribouPopGrowth
Browse files Browse the repository at this point in the history
  • Loading branch information
Hughes authored and Hughes committed Oct 2, 2024
1 parent fa86a46 commit 14604e3
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions R/caribouPopGrowth.R
Original file line number Diff line number Diff line change
Expand Up @@ -241,11 +241,11 @@ caribouPopGrowth <- function(N0,
if(sum(is.na(ad$N))>0){stop()}

N=ad$N
rr[paste0("lam",t)]=ad$Lambda
rr[paste0("lam",t)]= ad$Lambda
}

lamBits = names(rr)[grepl("lam",names(rr))]
rr$lambda=matrixStats::rowMeans2(as.matrix(subset(rr,select=lamBits)),na.rm=T)
rr$lambda=matrixStats::rowCumprods(as.matrix(subset(rr,select=lamBits)),na.rm=T)^(1/length(lamBits)) #geometric mean
rr=subset(rr,select=setdiff(names(rr),lamBits))
rr$N=N
rr$R_t=R_t/s #apparent reproduction
Expand Down

0 comments on commit 14604e3

Please sign in to comment.