Skip to content

Instantly share code, notes, and snippets.

@CnrLwlss
Created May 31, 2014 20:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save CnrLwlss/8d4e1166127107a45813 to your computer and use it in GitHub Desktop.
Save CnrLwlss/8d4e1166127107a45813 to your computer and use it in GitHub Desktop.
QFA logistic parameter bounds.
makeBoundsQFA<-function(inocguess,d,minK=0,fixG=FALSE,globalOpt=FALSE){
if(is.null(inocguess)){
# Without a sensible independent estimate for inoculum density, the best we can do is to estimate it based on observed data.
# This strategy will only work well if the inoculum density is high enough to be measurable (e.g. pinned cultures or
# conc. spotted) and is clearly observed. Clearly observed means: no condensation on plates immediately after they are
# placed in incubator for example.
if(length(d$Growth)>0) {candidate=min(d$Growth)}else{candidate=0}
inocguess=max(0.001,candidate)
}
# Define optimization bounds based on inocguess #
lowr<-0; upr<-25
lowv<-0.1; upv<-10.0
lowK<-max(0.9*inocguess,minK); upK<-1.0
# We often fix inoculation density, but users might prefer to infer it from growth curves
if(fixG) {lowg<-0.9*inocguess; upg<-1.1*inocguess}else{lowg<-0.01*inocguess; upg<-100.0*inocguess}
if(globalOpt) lowg<-1e-6*inocguess; upg<-1e6*inocguess
lowg<-max(0,lowg); upg<-min(upK,upg)
return(list(K=c(lowK,upK),r=c(lowr,upr),g=c(lowg,upg),v=c(lowv,upv),inocguess=inocguess))
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment