全部版块 我的主页
论坛 数据科学与人工智能 数据分析与数据科学 MATLAB等数学软件专版
1106 1
2013-03-13
我是winbugs的初学者,想问一下这个程序运行哪里有问题。。。
是想在公式a=alpha*deltaV中求参数alpha


多谢各位大神啊。。。实在没有找到哪里有问题




# linear regression
model {
      for (i in 1:20) {
      a[i] ~ dnorm(mu.a[i], tau)
      mu.a[i] <- alpha * deltaV[i]
   }
      #Priors for the regression parameters
      alpha ~ dnorm(0.1, 1.0E-6)
      #prior for the precision parameter
       tau ~ dgamma (1.0E-3, 1.0E-3)
      
      #monitor the standard deviation
       sigma <- 1/sqrt(tau)  
       }
   
# initials values
list(alpha=0, tau=1)


#Data
list   a[]  deltaV[]
-0.49 0.59
1.008 3.47
-2.302 3.34
0.912 1.38
-2.354 0.13
0.976 0.17
-2.238 0.49
-0.336 0.36
-0.457 0.02
-1.994 0.03
1.57 0.04
-1.91 0.02
1.52 0.01
-1.906 0.02
-0.048 0.02
1.507 0.02
-1.906 0.01
1.488 -1.53
4.072 -1.52
1.233 -1.38
end
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

全部回复
2013-9-1 01:13:24
# linear regression
model {
      for (i in 1:20) {
      a[i] ~ dnorm(mu.a[i], tau)
      mu.a[i] <- alpha * deltaV[i]
   }
      #Priors for the regression parameters
      alpha ~ dnorm(0.1, 1.0E-6)
      #prior for the precision parameter
       tau ~ dgamma (1.0E-3, 1.0E-3)
      
      #monitor the standard deviation
       sigma <- 1/sqrt(tau)  
       }
   
#Data
list(
a=c(-0.49,1.008,-2.302,0.912,-2.354,0.976,-2.238,-0.336,-0.457,-1.994,1.57,-1.91,1.52,-1.906,-0.048,1.507,-1.906,1.488,4.072,1.233),
deltaV=c(0.59,3.47,3.34,1.38,0.13,0.17,0.49,0.36,0.02,0.03,0.04,0.02,0.01,0.02,0.02,0.02,0.01,-1.53,-1.52,-1.38),
)

# initials values
list(alpha=0, tau=1)
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

相关推荐
栏目导航
热门文章
推荐文章

说点什么

分享

扫码加好友,拉您进群
各岗位、行业、专业交流群