model{

      for( i in 1 : N ) {
      ## Likelihood ##
        M[i] ~ dnorm(m[i], tau[i])
        tau[i] <- 1/(s[i]*s[i])
        m[i] ~ dnorm(mu[i], tauC[i])
        
      # Linear Interpolation for the calibration of radiocarbon dates
        mu[i] <- interp.lin(t[i], Xca, Gca)
        sigma[i] <- interp.lin(t[i], Xca, SDca)
        tauC[i] <- 1/(sigma[i]*sigma[i])
        
        t[i] ~ dnorm(theta, prec.date[i])
        
      # Introduction of a random effect : use of the Shrinkage distribution
      # this help handling potential outliers
        u[i] ~ dunif(0,1) 
        prec.date[i] <- 1/s02 *u[i]/(1-u[i])  
        sd[i] <- 1/sqrt(prec.date[i])
      }
      
      ## Prior distribution of the date of interest ##
      theta ~ dunif(ta,tb)
      
      }
     