I have developed a Metropolis-Hastings Algorithm for a double sigmoidal model, but now the aim is to create a Bayesian Hierarchical model that depends on incoming temperature data. For example, the asymptote parameter will be written as:

$$\alpha_{0t} = \alpha_{0} + T*u_{t},$$ $$\alpha_{0} \sim N(90,10),$$ $$u_{t} \sim N(0, \sigma^2)$$

where T is the temperature data. The current sampler for this variable is as follows, with all the other relevant variables included in the loglikelihood functions:

a0n <- rnorm(1,a0,0.025)
logR <- loglik(x,y,a0n,adelt,b0,bdelt,g0,g1,tau)-
loglik(x,y,a0,adelt,b0,bdelt,g0,g1,tau) +
dnorm(a0n,mu.a0,sd.a0,log = T)-
dnorm(a0,mu.a0,sd.a0,log = T)

logcheck <- log(runif(1,0,1))

if(logR>logcheck) {a0 <- a0n}

What changes would I make so that the algorithm considers the hierarchical nature from the temperature information?


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.