user21988672
user21988672

Reputation:

Error in jags model: Parameter estimation for a fractional Caputo model

I am working on Bayesian estimation with the aim of finding the posterior distribution of a fractional model using the Caputo derivative.
However, when I compile the fitting model I get the following error and I have not been able to identify it.

> fit.caputo<-jags(data=caputo.data, inits = caputo.inits1, parameters.to.save= caputo.params,
+                  n.chains =2, n.iter = 10000, n.burnin=1000,model.file="caputo.jags")
module glm loaded
Compiling model graph
   Resolving undeclared variables
Deleting model

Error in jags.model(model.file, data = data, inits = init.values, n.chains = n.chains,  : 
  RUNTIME ERROR:
Compilation error on line 10.
Inconsistent dimensions for array W

Here is the code:


cat("
model{
# likelihood
 for(t in 1:N1)
  {
  y1[t] ~ dnorm(V[t], tau)
  y2[t] ~ dnorm(W[t], tau)
    for(k in 1:t){
    V[t+1, k]= V[1]+ ((h^q)/(exp(loggam(q+1)))) * sum ( ((t-k+1)^(q)-(t-k)^(q))* (r1*V[k]*(1-V[k]/k1) -a*V[k]*W[k]) )
    W[t+1, k]= W[1]+ ((h^q)/(exp(loggam(q+1)))) * sum ( ((t-k+1)^(q)-(t-k)^(q))* (a*V[k]*W[k]-r2*W[k]) )
    }
 }
V[1]<-v0
W[1]<-w0
#tamaño de paso
h=0.01
#distribucuiones iniciales
a ~ dnorm(0.06,10000)T(0,1)
k1 ~ dnorm(50,1)
r1 ~ dnorm(1.8,1000)T(0,) 
r2 ~ dnorm(0.24,1000)T(0,)
q ~ dunif(0.9,1)
  sigma2 <- 1/tau
  tau ~ dgamma(1,1) # media =1 y var=10
}", file="caputo.jags", fill=T)

Previously, I generated a synthetic data set from the numerical solution of the system (For this purpose use the Fractional forward Euler method).
Thanks in advance for your suggestions

Upvotes: 0

Views: 31

Answers (0)

Related Questions