R/model_generator.R

Defines functions model_generator

Documented in model_generator

model_generator <-
function(domain, par_low, par_high) {
  dom = domain[2]-domain[1]
  slopes = do.call(c, lapply(par_high, function(x) (x-par_low)/dom))
  ints = slopes*(-domain[1]) + par_low
  models=cbind(slopes, ints)
  if(length(par_high)==1) {
    models=models[-which(is.na(models[,1])),]
  }
  if(length(par_low)==1) {
    models=models[-which(is.na(models[,2])),]
  }
  return(models)
}

Try the diverge package in your browser

Any scripts or data that you put into this service are public.

diverge documentation built on Dec. 28, 2022, 2 a.m.