Skip to content

Commit

Permalink
Give warnings if trying to optimize with 0 immigration rate or 0 exti…
Browse files Browse the repository at this point in the history
…nction rate.
  • Loading branch information
rsetienne committed Oct 21, 2024
1 parent e09772a commit f8b3666
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion R/DAISIE_ML_IW.R
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ DAISIE_ML_IW <- function(
}
np = datalist[[1]]$not_present
if (is.null(np)) {
np = datalist[[1]]$not_present_type1 + datalist[[1]]$not_present_type2
np <- datalist[[1]]$not_present_type1 + datalist[[1]]$not_present_type2
warning('Number of species not present is misspecified.\n')
return(invisible(out2err))
}
Expand All @@ -130,6 +130,18 @@ DAISIE_ML_IW <- function(
verbose = verbose
)

pars1 <- rep(0, 5)
pars1[idparsopt] <- parsopt
if (length(idparsfix) != 0) {
pars1[idparsfix] <- parsfix
}
if (pars1[4] == 0) {
warning('You have chosen a zero immigration rate; an empty island will never be colonized')
}
if (pars1[2] == 0) {
warning('You have chosen a zero extinction rate; this might create problems in optimization; please use a number close to 0 instead')
}

trparsopt <- initparsopt / (1 + initparsopt)
trparsopt[which(initparsopt == Inf)] <- 1
trparsfix <- parsfix / (1 + parsfix)
Expand Down

0 comments on commit f8b3666

Please sign in to comment.