Code Monkey home page Code Monkey logo

debinfer's People

Contributors

pboesu avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

debinfer's Issues

Lists of parameters

Dear Dr. Boersch-Supan (and collaborators).

Quick question: is there a simple way to perform inference for lists of parameters?

For example, in a consumer resource model each species has it's own growth rate. In deSolve I can pass this in as a list and evaluate a series of equations using a loop.

My first intuition was to initialise multiple values when declaring the parameter:

mu <- debinfer_par(name = "mu", var.type = "de", fixed = FALSE,
          value = rep(0.5, n),
          prior = "norm", hypers = list(mean = 0, sd = 1), 
          prop.var = 0.0001, samp.type="rw")

My second is to write everything out long-hand mu1, mu2, ... which I'd like to avoid.

Any help appreciated,

Cheers,
Andrew

Error message when solver fails

[1] "proposal outside prior support for Tmin = 1.79816012912371"
DLSODA-  ITASK = 4 or 5 and TCRIT (=R1) behind TCUR (=R2)   
In above message, R1 = 7, R2 = 7

Error in lsoda(y, times, func, parms, lags = control, ...) : 
  illegal input detected before taking any integration steps - see written message
 [1] "Solver failed with current state = 1.12203262641034 and proposal ds = 1.50219312234621"  "Solver failed with current state = 0.913153225090355 and proposal ds = 1.50219312234621"
 [3] "Solver failed with current state = 1.35363732916556 and proposal ds = 1.50219312234621"  "Solver failed with current state = 0.673927449394947 and proposal ds = 1.50219312234621"
 [5] "Solver failed with current state = 15.573702506406 and proposal ds = 1.50219312234621"   "Solver failed with current state = 2.42665556177606 and proposal ds = 1.50219312234621" 
 [7] "Solver failed with current state = 120 and proposal ds = 1.50219312234621"               "Solver failed with current state = 0 and proposal ds = 1.50219312234621"                
 [9] "Solver failed with current state = 0 and proposal ds = 1.50219312234621"                 "Solver failed with current state = -443.989025874076 and proposal ds = 1.50219312234621"
[1] "posterior not finite for proposal ds = 1.50219312234621"

The sample vector should be collapsed before pasting together the error message

double check that vignettes work

Within R, I can find the vignettes in the doc directory but they don't seem accessible via the vignette command. For example, after loading the deBInfer package, the following command
vignette("logistic_ode_example",package="deBInfer")
results in the warning message...
vignette ‘logistic_ode_example’ not found

Compiled deSolve models

Does the package work with compiled ODE models (as described in vignette("compiledCode")? I didn't chase this throughm but it looks like it from the look of solve_de, but not from the definition of de_mcmc. This would probably be worth documenting and testing because by the time you're doing inference with an ODE/DDE system users would probably want the equations as fast as possible. If you do do this, what sort of speed up do you see?

more generic interface for solver

The solver system is not open to extension in its current state:

  if(solver == 1 || solver == "ode"){
    #require(deSolve)
    out <- try(ode(inits, times, sim, parms=params, verbose=verbose , method=method, ...))
  }

Is there a reason why solver can't be made more generic? All it would really take is passing solver in as a function (along with a description of the form it should take). The existing ode/dde/dede if/else statements could be largely replaced by a little bit of wrapper code, such as:

if (is.character(solver)) {
  if (solver == "ode") {
    solver <- deSolve::ode(inits, times, sim, params, 
                           verbose=verbose, method=method, ...)
  } # ...and so on for the others.
}

In any case, because the method parameters passed along is the same as the default to ode, it can be dropped and passed along with ....

how to implement inter-dependent initial conditions for systems of constant population size

Thank you so for much for this promising-looking package!

I was wondering how one would go about defining initial conditions that depend on each other. In population dynamics with a constant number of individuals, e.g.

dA/dt = -A
dB/dt = +A,

the total number of individuals is given by N = A(t) + B(t) = const at all times . If I want to use B(0) as a parameter to infer, is there any way to tell the package that at all times

A(0) = N - B(0)

while B(0) is not fixed?

loop indexing

Caution applies with 1:n (prefer seq_len(n)) and 1:length(x) (prefer seq_along(n)).

Addition to DDE vignette

A suggested addition to the DDE vignette - to present all the posterior predictive trajectories on a single figure e.g.

plot(chytrid, xlab="Time (days)", ylab= "Zoospores x 10e4", xlim=c(0,10))

for(i in 1:100){
  DATA1 <- as.data.frame(post_traj$sims[i])
  lines(DATA1[,2] ~ DATA1[,1])
  lines(DATA1[,3] ~ DATA1[,1],col="red")
  lines(DATA1[,4] ~ DATA1[,1],col="blue")
}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.