Skip to content

Commit

Permalink
Fix error in simulation of recruitment data.
Browse files Browse the repository at this point in the history
  • Loading branch information
Hughes authored and Hughes committed Jan 17, 2025
1 parent fdfcad3 commit 7bf91ff
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion R/internal_demog_fns.R
Original file line number Diff line number Diff line change
Expand Up @@ -169,12 +169,13 @@ simCalfCowRatios <- function(cowCounts, minYr, exData) {

if(sum(ageRatioOut$cow>ageRatioOut$N,na.rm=T)){
warning("The expected number of cows in composition survey exceeds population size. Adjusting cows in survey for consistency.")
ageRatioOut$cow = pmin(ageRatioOut$cow,ageRatioOut$N)
}

#apparent number of calves (M+F) from apparent number of cows using apparent recruitment rate
ageRatioOut$calf <- ifelse(ageRatioOut$cow == 0, 0,
rbinom(
n = nrow(ageRatioOut), size = pmin(ageRatioOut$cow,ageRatioOut$N),
n = nrow(ageRatioOut), size = ageRatioOut$cow,
prob = ageRatioOut$recruitment
)
)
Expand Down
2 changes: 1 addition & 1 deletion man/popGrowthTableJohnsonECCC.Rd

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

0 comments on commit 7bf91ff

Please sign in to comment.