r2winbugs包中的bugs和openbugs函数有什么不同
1个回答
展开全部
以下例子有如何用R调用winbugs,如果是openbugs需要加载另外一个包
> # R code with interface to Winbugs
>
> library(R2WinBUGS)
> y<-read.table("D:/Bugs/jump.dat",header=TRUE) #import data#
> N<-length(y)
> Xi0<-rep(0,N) # Give initial values to state variables#
> J0<-rep(0,N)
> data<-list("N","y")
> # Give initial values to the parameters for winbugs #
> inits <-function() {list ( tau=2,
+ Jtau=2,
+ mu=0,
+ Jmu=0,
+ lamda = 0.05, Xi=Xi0,J=J0)}
> parameters<- c("Sigma","JSigma","mu","Jmu","lamda","Xi","J")
> # quote the winbugs#
> jump.sim<-bugs (data, inits=inits, parameters, "model.bug", n.chains=3, n.iter=1000,debug=TRUE,
+ DIC=TRUE,bugs.directory = "D:/Program Files/WinBUGS14/",working.directory = "D:/Bugs")
错误于is.finite(x) : 没有为'list'类型实现默认的方法
> # R code with interface to Winbugs
>
> library(R2WinBUGS)
> y<-read.table("D:/Bugs/jump.dat",header=TRUE) #import data#
> N<-length(y)
> Xi0<-rep(0,N) # Give initial values to state variables#
> J0<-rep(0,N)
> data<-list("N","y")
> # Give initial values to the parameters for winbugs #
> inits <-function() {list ( tau=2,
+ Jtau=2,
+ mu=0,
+ Jmu=0,
+ lamda = 0.05, Xi=Xi0,J=J0)}
> parameters<- c("Sigma","JSigma","mu","Jmu","lamda","Xi","J")
> # quote the winbugs#
> jump.sim<-bugs (data, inits=inits, parameters, "model.bug", n.chains=3, n.iter=1000,debug=TRUE,
+ DIC=TRUE,bugs.directory = "D:/Program Files/WinBUGS14/",working.directory = "D:/Bugs")
错误于is.finite(x) : 没有为'list'类型实现默认的方法
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询