WinBUGS: Nonlinear regression model
Revisiting Example
3.7 (pages 102-3) on non-linear regression with exponential decay
yi ~ N(b1- b1exp(-b2xi),t -2)
where y are oxygen concentrations and x are the number of days the experiments are carried out.
Data: x = (1,2,3,4,5,7) and y = (8.3,10.3,19,16,15.6,19.8).
Prior: p( b1,b2,t2) = p( b1) p( b2) p(t2) and
β1 ~ U(-20,50)
β2 ~ U(-2,6)
t2 ~ G(0.001,0.001)
WINBUGS CODE FOR THE NONLINEAR MODEL
# NONLINEAR
MODEL
model{
for (i in 1:N){
mu[i] <-
beta1*(1-exp(-beta2*x[i]))
y[i]~dnorm(mu[i],tau2)
}
beta1~dunif(-20,50)
beta2~dunif(-2,6)
tau2 ~ dgamma(0.001,0.001)
}
# DATA
list(x=c(1,2,3,4,5,7),y=c(8.3,10.3,19,16,15.6,19.8),N=6)
# 2 SETS OF INITIAL VALUES
list(beta1=18,beta2=1.78,tau2=1)
list(beta1=-10,beta2=0,tau2=1)