model
{
#likelihood
for(i in 1:n){
for(j in 1:m-1){
x[i,j]~ dnorm( mu[i,j], tau0[i])
mu[i,j]<- mu1[i]*exp(-mu10/s)*(t[j+1]-t[j])*a+mu1[i]*exp(-mu10/s)*(tau[i]-t[j])*b+mu2[i]*exp(-mu20/s)*(t[j+1]-tau[i])*b+mu2[i]*exp(-mu20/s)*(t[j+1]-t[j])*c
sigmatau0<-1/sqrt(tau0[i]*(t[j+1]-t[j]))
s~ dunif(1,100)
a<-step( tau[i]-t[ j+1] )
b<-(step(tau[i]- t[j])-(step(tau[i]- t[j+1])))
c<-(1-step( tau[i]-t[j]))
}
#prior
tau[i]~dnorm(mutau,tautau)
mutau~dnorm(0, 0.001)
tautau~dgamma(0.01, 0.01)
sigmatau<-1/sqrt(tautau)
mu1[i]~dnorm(mumu1, tau1)
mumu1~dnorm(0, 0.001)
tau1~dgamma(0.01,0.01)
sigmatau1<-1/sqrt(tau1)
mu10~dunif(0, 1)
mu2[i]~dnorm(mumu2, tau2)
mumu2~dnorm(0, 0.001)
tau2~dgamma(0.01,0.01)
sigmatau2<-1/sqrt(tau2)
mu20~dunif(0, 1)
tau0[i]~dgamma(alpha,beta)
}
}
DATA
list(
n=3, m=24,
t=c(0,30,60,90,120,150,180,210,240,270,300,330,360,390,420,
450,480,510,540,570,600,630,660,690)
x= structure(
.Data=c(6.4594, 5.5841, 3.2052, 1.1038, 0.4131, 0.2411, 0.2547, 0.2912, 0.2756, 0.2594, 0.2318, 0.2295, 0.2532, 0.226, 0.1925, 0.2582, 0.28, 0.2748, 0.3253, 0.2603, 0.2411, 0.2749, 0.2753, 6.9293, 5.5254, 3.1079, 0.7795, 0.2667, 0.2979, 0.2528, 0.3239, 0.3186, 0.2133, 0.292, 0.2674, 0.3593, 0.2767, 0.229, 0.25, 0.2926, 0.308, 0.2468, 0.2975, 0.3307, 0.2629, 0.2767, 6.8042, 6.1303, 2.4055, 0.8204, 0.193, 0.275, 0.3019, 0.2845, 0.252, 0.2498, 0.1863, 0.2808, 0.3119, 0.3211, 0.324, 0.1898, 0.3368, 0.3187, 0.1681, 0.2334, 0.3163, 0.3208, 0.2804),
. Dim = c(3, 23))) 3行23列的矩阵
INITS
list( mutau=0, tautau=1, mumu1=0, tau1=1, mumu2=0, tau2=1, alpha=0.01, beta=0.01)
在“load data”时,总显示“undefined data” 在 ‘x= structure(.Data=’ 这部分。
另外数据不够的情况下,如何通过仿真模拟然后进行估参呢?
万分感谢!


雷达卡


京公网安备 11010802022788号







