pboesu / debinfer Goto Github PK
View Code? Open in Web Editor NEWBayesian inference for dynamical models of biological systems in R
Home Page: http://doi.org/10.1111/2041-210X.12679
Bayesian inference for dynamical models of biological systems in R
Home Page: http://doi.org/10.1111/2041-210X.12679
see here: travis-ci/travis-ci#6139
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?
Hello,
would you have an example on how to specify a truncated normal distribution for a prior in debinfer_par? looked through repository but could not find example... For example, how would I specify debinfer_par for a parameter with normal distribution, mean of 5, sd of 2, lower end of 1 and upper end of 10? Tried the following but error message pops for unused variables:
debinfer_par(name = "par_a", var.type = "de", fixed = FALSE,value = 5, prior = "norm", hypers = list(mean = 5, sd = 2,a = 1, b = 10),prop.var = c(4), samp.type = "rw")
and to confirm, the prop.var variable for my example would be squared 2 = 4, the variance?
much appreciate the help,
Andras
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")
}
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
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 ...
.
https://github.com/pboesu/debinfer/blob/95ea267/R/de_mcmc_rev.R#L37
This seems overly restrictive; it would be nicer if you could use deSolve-style positional argument matching rather than require specific argument names.
https://github.com/pboesu/debinfer/blob/95ea267/R/de_mcmc_rev.R#L41
Prefer vapply(all.params, function(x) x$name, character(1))
to get better behaviour on unexpected input (e.g, all.params=NULL
).
The PBSddesolve
package is not available for download anymore, which is causing this dependency clash. Is there a way around it?
Thanks
https://github.com/pboesu/debinfer/blob/95ea267/R/de_mcmc_rev.R#L57 (and elsewhere)
Don't use print()
where you mean message()
, and consider making conditional behind a verbose argument.
Please add in an auto.layout option.
How to use truncated normal distribution as a prior in deBInfer?
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?
[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
Some characters in the example code in the manuscript PDF are replaced by spaces when copying and pasting.
this, and a straightforward command to simulate & plot from initial values would be helpful for troubleshooting ill-behaved DE models.
A suggestion to add a CoC.
Caution applies with 1:n
(prefer seq_len(n)
) and 1:length(x)
(prefer seq_along(n)
).
Throughout the code examples in the paper/vignettes, be consistent with use of <-
and =
. (e.g., p.10, l. 185)
HPD is not plotted when the default value for color is overwritten by a single color name
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
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.