Discussion:
[R] errors in initial values in R2winBUGS
thanoon younis
2014-10-11 04:09:13 UTC
Permalink
Dear all R users
I am trying to find the bayesian analysis using R2winBUGS but i have errors
in initial values with two groups.
the R-code
#Initial values for the MCMC in WinBUGS

init1<-list(uby1=rep(0.0,10),lam1=c(0.0,0.0,0.0,0.0,0.0,0.0),
gam1=c(1.0,1.0,1.0,1.0,1.0,1.0),psd1=1.0,phi1=matrix(data=c(1.0,0.0,0.0,0.0,1.0,0.0,0.0,0.0,1.0),ncol=3,byrow=TRUE),uby2=rep(0.0,10),lam2=c(0.0,0.0,0.0,0.0,0.0,0.0),
gam2=c(1.0,1.0,1.0,1.0,1.0,1.0),psd2=1.0,phi2=matrix(data=c(1.0,0.0,0.0,0.0,1.0,0.0,0.0,0.0,1.0),ncol=3,byrow=TRUE),
xi1=matrix(data=rep(0.0,600),ncol=3),xi2=matrix(data=rep(0.0,600),ncol=3)),

init2<-list(uby1=rep(0.5,10),lam1=c(0.5,0.5,0.5,0.5,0.5,0.5),
gam1=c(0.0,0.0,0.0,0.0,0.0,0.0),psd1=0.6,phi1=matrix(data=c(1.0,0.0,0.0,0.0,1.0,0.0,0.0,0.0,1.0),ncol=3,byrow=TRUE),uby2=rep(0.5,10),lam2=c(0.5,0.5,0.5,0.5,0.5,0.5),
gam2=c(0.0,0.0,0.0,0.0,0.0,0.0),psd2=0.6,phi2=matrix(data=c(1.0,0.0,0.0,0.0,1.0,0.0,0.0,0.0,1.0),ncol=3,byrow=TRUE),
xi1=matrix(data=rep(0.0,600),ncol=3),xi2=matrix(data=rep(0.0,600),ncol=3)),


and the errors are

Error: unexpected ',' in:
"3,byrow=TRUE),uby2=rep(0.0,10),lam2=c(0.0,0.0,0.0,0.0,0.0,0.0),
gam2=c(1.0,1.0,1.0,1.0,1.0,1.0),psd2=1.0,phi2=matrix(data=c(1.0,0.0,0.0,0.0,1.0,0.0,0.0,0.0,1.0),ncol=3,byrow=TRUE),
xi1=matrix(data=rep(0.0,600),ncol=3),xi2=matrix(data=rep(0.0,600),ncol=3)),"

and

Error: unexpected ',' in:
"3,byrow=TRUE),uby2=rep(0.5,10),lam2=c(0.5,0.5,0.5,0.5,0.5,0.5),
gam2=c(0.0,0.0,0.0,0.0,0.0,0.0),psd2=0.6,phi2=matrix(data=c(1.0,0.0,0.0,0.0,1.0,0.0,0.0,0.0,1.0),ncol=3,byrow=TRUE),
xi1=matrix(data=rep(0.0,600),ncol=3),xi2=matrix(data=rep(0.0,600),ncol=3)),"



any help would be greatly appreciated
--
Thanoon Y. Thanoon
PhD Candidate
Department of Mathematical Sciences
Faculty of Science
University Technology Malaysia, UTM
E.Mail: Thanoon.younis80 at gmail.com
E.Mail: dawn_prayer80 at yahoo.com
Facebook:Thanoon Younis AL-Shakerchy
Twitter: Thanoon Alshakerchy
H.P:00601127550205

[[alternative HTML version deleted]]
Uwe Ligges
2014-10-11 21:06:57 UTC
Permalink
Post by thanoon younis
Dear all R users
I am trying to find the bayesian analysis using R2winBUGS but i have errors
in initial values with two groups.
the R-code
#Initial values for the MCMC in WinBUGS
init1<-list(uby1=rep(0.0,10),lam1=c(0.0,0.0,0.0,0.0,0.0,0.0),
gam1=c(1.0,1.0,1.0,1.0,1.0,1.0),psd1=1.0,phi1=matrix(data=c(1.0,0.0,0.0,0.0,1.0,0.0,0.0,0.0,1.0),ncol=3,byrow=TRUE),uby2=rep(0.0,10),lam2=c(0.0,0.0,0.0,0.0,0.0,0.0),
gam2=c(1.0,1.0,1.0,1.0,1.0,1.0),psd2=1.0,phi2=matrix(data=c(1.0,0.0,0.0,0.0,1.0,0.0,0.0,0.0,1.0),ncol=3,byrow=TRUE),
xi1=matrix(data=rep(0.0,600),ncol=3),xi2=matrix(data=rep(0.0,600),ncol=3)),
The comma at the very end is too much ....

Best,
Uwe Ligges
Post by thanoon younis
init2<-list(uby1=rep(0.5,10),lam1=c(0.5,0.5,0.5,0.5,0.5,0.5),
gam1=c(0.0,0.0,0.0,0.0,0.0,0.0),psd1=0.6,phi1=matrix(data=c(1.0,0.0,0.0,0.0,1.0,0.0,0.0,0.0,1.0),ncol=3,byrow=TRUE),uby2=rep(0.5,10),lam2=c(0.5,0.5,0.5,0.5,0.5,0.5),
gam2=c(0.0,0.0,0.0,0.0,0.0,0.0),psd2=0.6,phi2=matrix(data=c(1.0,0.0,0.0,0.0,1.0,0.0,0.0,0.0,1.0),ncol=3,byrow=TRUE),
xi1=matrix(data=rep(0.0,600),ncol=3),xi2=matrix(data=rep(0.0,600),ncol=3)),
and the errors are
"3,byrow=TRUE),uby2=rep(0.0,10),lam2=c(0.0,0.0,0.0,0.0,0.0,0.0),
gam2=c(1.0,1.0,1.0,1.0,1.0,1.0),psd2=1.0,phi2=matrix(data=c(1.0,0.0,0.0,0.0,1.0,0.0,0.0,0.0,1.0),ncol=3,byrow=TRUE),
xi1=matrix(data=rep(0.0,600),ncol=3),xi2=matrix(data=rep(0.0,600),ncol=3)),"
and
"3,byrow=TRUE),uby2=rep(0.5,10),lam2=c(0.5,0.5,0.5,0.5,0.5,0.5),
gam2=c(0.0,0.0,0.0,0.0,0.0,0.0),psd2=0.6,phi2=matrix(data=c(1.0,0.0,0.0,0.0,1.0,0.0,0.0,0.0,1.0),ncol=3,byrow=TRUE),
xi1=matrix(data=rep(0.0,600),ncol=3),xi2=matrix(data=rep(0.0,600),ncol=3)),"
any help would be greatly appreciated
Daniel Miquelluti
2014-10-12 00:32:04 UTC
Permalink
You are separating the objects using commas, the correct should be semicolons.

Example:
xi1=matrix(data=rep(0.0,600),ncol=3);xi2=matrix(data=rep(0.0,600),ncol=3))


Best regards,
Daniel Miquelluti
Post by thanoon younis
Dear all R users
I am trying to find the bayesian analysis using R2winBUGS but i have errors
in initial values with two groups.
the R-code
#Initial values for the MCMC in WinBUGS
init1<-list(uby1=rep(0.0,10),lam1=c(0.0,0.0,0.0,0.0,0.0,0.0),
gam1=c(1.0,1.0,1.0,1.0,1.0,1.0),psd1=1.0,phi1=matrix(data=c(1.0,0.0,0.0,0.0,1.0,0.0,0.0,0.0,1.0),ncol=3,byrow=TRUE),uby2=rep(0.0,10),lam2=c(0.0,0.0,0.0,0.0,0.0,0.0),
gam2=c(1.0,1.0,1.0,1.0,1.0,1.0),psd2=1.0,phi2=matrix(data=c(1.0,0.0,0.0,0.0,1.0,0.0,0.0,0.0,1.0),ncol=3,byrow=TRUE),
xi1=matrix(data=rep(0.0,600),ncol=3),xi2=matrix(data=rep(0.0,600),ncol=3)),
The comma at the very end is too much ....

Best,
Uwe Ligges
Post by thanoon younis
init2<-list(uby1=rep(0.5,10),lam1=c(0.5,0.5,0.5,0.5,0.5,0.5),
gam1=c(0.0,0.0,0.0,0.0,0.0,0.0),psd1=0.6,phi1=matrix(data=c(1.0,0.0,0.0,0.0,1.0,0.0,0.0,0.0,1.0),ncol=3,byrow=TRUE),uby2=rep(0.5,10),lam2=c(0.5,0.5,0.5,0.5,0.5,0.5),
gam2=c(0.0,0.0,0.0,0.0,0.0,0.0),psd2=0.6,phi2=matrix(data=c(1.0,0.0,0.0,0.0,1.0,0.0,0.0,0.0,1.0),ncol=3,byrow=TRUE),
xi1=matrix(data=rep(0.0,600),ncol=3),xi2=matrix(data=rep(0.0,600),ncol=3)),
and the errors are
"3,byrow=TRUE),uby2=rep(0.0,10),lam2=c(0.0,0.0,0.0,0.0,0.0,0.0),
gam2=c(1.0,1.0,1.0,1.0,1.0,1.0),psd2=1.0,phi2=matrix(data=c(1.0,0.0,0.0,0.0,1.0,0.0,0.0,0.0,1.0),ncol=3,byrow=TRUE),
xi1=matrix(data=rep(0.0,600),ncol=3),xi2=matrix(data=rep(0.0,600),ncol=3)),"
and
"3,byrow=TRUE),uby2=rep(0.5,10),lam2=c(0.5,0.5,0.5,0.5,0.5,0.5),
gam2=c(0.0,0.0,0.0,0.0,0.0,0.0),psd2=0.6,phi2=matrix(data=c(1.0,0.0,0.0,0.0,1.0,0.0,0.0,0.0,1.0),ncol=3,byrow=TRUE),
xi1=matrix(data=rep(0.0,600),ncol=3),xi2=matrix(data=rep(0.0,600),ncol=3)),"
any help would be greatly appreciated
______________________________________________
R-help at r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
[[alternative HTML version deleted]]

Loading...