search for: mdlchooser

Displaying 1 result from an estimated 1 matches for "mdlchooser".

Did you mean: gdmchooser
2010 Aug 10
4
Function to Define a Function
...that allows the user to create a new function that depends on their ## choice in the type argument. As a simple example, if the user chooses "one" ## then the output function is exponential growth, if the user choses "two" then ## thhe output function is logistic growth. mdlChooser <- function(type=c("one","two")) { type <- match.arg(type) switch(type, one={ m <- function(x,N0,r) N0*exp(x*r) }, two={ m <- function(x,N0,r,K) (N0*K)/(N0+(K-N0)*exp(-x*r)) }, ) m } ## define time steps t <- 0:10 ## create a function -- junk1 --...