Thank you Dr Petzoldt, I did review the examples and I think I am very close to solving the problem! I decided to go with using the modCost function to generate my f for modMCMC, and am getting reasonable results. I will spend some more time on it, still having some issues with defining the function for  a normal prior... Besides, that I would like to ask if the group could help me identifying why the differential equation system does not pick up my second input of rate 800 for 0.5 h starting at 12 h and ending at 12.5? I have gone through it several times, but can not find the error. I appreciate the help. here is the code:
 
require(deSolve)
require(FME)
pkmod <- function(t, y, p) {
  inp <- forc(t)
  dy1 <- - p["k"]* y[1] + inp
  list(c(dy1), inp=inp)
}
intimes <- c(0,0.5,12,12.5,24)
input   <- c(800,0,800,0,0)
forc <- approxfun(intimes, input, method="constant")
times <- seq(0,24,by=0.25)
yini <- c(Central = 0)
p    <- c(k=0.108)
result <- lsoda(yini, times, pkmod, p, rtol = 1e-08, atol = 1e-08)

result <- data.frame(result)
names(result) <- c("time","Amount")
plot(result$Amount ~ result$time, type="b", main="Central compartment", xlab="time", ylab="Amount")

 
thank you for the input,
 
Andras

--- On Thu, 4/25/13, Thomas Petzoldt <Thomas.Petzoldt@TU-Dresden.de> wrote:


From: Thomas Petzoldt <Thomas.Petzoldt@TU-Dresden.de>
Subject: Re: [R-sig-dyn-mod] ] Bayesian model fitting and deSolve
To: "Special Interest Group for Dynamic Simulation Models in R" <r-sig-dynamic-models@r-project.org>
Date: Thursday, April 25, 2013, 12:07 PM


Andreas,

as far as I see, FME's modMCMC should be suitable for your purpose,
examples are given in the the package vignettes:

1. Inverse Modelling, Sensitivity and Monte Carlo Analysis in R Using
Package FME (same as J. Stat. Softw. 2010 33(3))

2. Sensitivity, Calibration, Identifiability, Monte Carlo Analysis of a
Dynamic Simulation Model

The examples therein can serve as a starting point, just try it out. If
this is not enough, a wide variety of other packages for Bayesian model
fitting can be found in the "Bayesian" CRAN task view.


Thomas P.

_______________________________________________
R-sig-dynamic-models mailing list
R-sig-dynamic-models@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-sig-dynamic-models

	[[alternative HTML version deleted]]

