R/OdeSystem.R

Defines functions OdeSystem

#' Ode Class definition
#'
#' @export

OdeSystem <- function(func,param,init,modname=c("S","E","I","R","A","H"),
                      variabilty=list(),
                      isregressor=list(),
                      distribution=list(),
                      Data=list(),
                      estiomationregressor=list(),
                      isspecificinit=rep(0,length(init)))
{
  # Set all variability info to 0
  if (length(variabilty)==0){
    variabilty$param<-rep(0,length(param))
    variabilty$init<-rep(0,length(init))
  }
  # Set all regressor info to 0
  if (length(isregressor)==0){
    isregressor$param<-rep(0,length(param))
    isregressor$init<-rep(0,length(init))
  }
  # Set all distribution to logNormal (default)
  if (length(distribution)==0){
    distribution$param<-rep("logNormal",length(param))
    distribution$init<-rep("logNormal",length(init))
  }
  if (length(estiomationregressor)==0){
    estiomationregressor$param<-rep(0,length(param))
    estiomationregressor$init<-rep(0,length(init))
  }
  # Struct of the data Input
  Data$File=""
  Data$HeaderType=""
  Data$Sep=""
  ModelFile=""
  
  # Class
  ode <- list(
    ode_def=func,
    ModelFile=ModelFile,
    NumberObservation=0,
    parameter = param,
    InitState = init,
    ncomp= length(modname),
    Variability= variabilty,
    ModelName= modname,
    IsRegressor=isregressor,
    Distribution=distribution,
    EstimationRegressor=estiomationregressor,
    DataInfo=Data,
    IsSpecificInit=isspecificinit, 
    ParamRandomEffect=list() # not used any more
    )
  
  class(ode) <- append(class(ode),"OdeSystem")
  return(ode)
}
sistm/SEIRcovid19 documentation built on Aug. 9, 2021, 7:37 a.m.