Quantcast
Channel: Active questions tagged r - Stack Overflow
Viewing all articles
Browse latest Browse all 201867

Getting error message "Error in checkFunc(Func2, times, y, rho) : Model function must return a list"

$
0
0

I am working on a model to predict the incidence of an infectious disease and have a model for it which was functioning well till yesterday. Now I get the message:

Error in checkFunc(Func2, times, y, rho) : 
  Model function must return a list

Here is the code:

library(deSolve)

run.model <- function(years,parameters,initial.state){

    years.needed = c(min(years)-1, years)
    results = ode(y=as.numeric(initial.state),
                  times=years.needed,
                  func=dx.model,
                  parms=parameters)

    rv = list()

    rv$parameters = parameters
    rv$years = years

    rv$results = process.ode.results(results, years)
    rv

}
sim = run.model(years=1500:2020,
          parameters=make.parameters(log.trate.hiv.neg.slope = log(1), 
                                     log.trate.hiv.neg.intercept = log(7),
                                     early.progression.risk.immune=0.00485*4.5,
                                     late.progression.risk.immune = 0.0005*4.5,
                                     latent.duration = 5,
                                     treat.tb.rate = 0.6,
                                     primary.progression.in.immune = .014),

                    initial.state = init.state)

I have no idea why I am getting this error.


Viewing all articles
Browse latest Browse all 201867

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>