[R] Problem in R2WinBUGS

thanoon younis thanoon.younis80 at gmail.com
Wed Dec 31 08:27:30 CET 2014


Dear all members
I have a problem with the code below when i wanted to change the continuous
random variables to mixed ordered categorical and dichotomous as follow

 #transform theta to ordinal variables
       yo <- array(0, dim=c(i,5,100))
       for(j in 1:5){
       if(v[j] < 0.25){
       yo[i,j,t] = 1
       }else if(v[j] >=0.25 & v[j] < 0.5){
       yo[i,j,t] = 2
       }else if(v[j] >=0.5 & v[j] < 0.75){
       yo[i,j,t] = 3
       }else{
       yo[i,j,t] = 4
       }
       }}

    #transform theta1 to dichotomousvariables
    for (j in 6:9) { if (v[j]>0) yo[i,j,t]<-1 else yo[i,j,t]<-0 }

i found this error


*Error in yo[i, j, t] <- 1 : subscript out of bounds*



any Guidance would highly appreciated.

Regards
-- 
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]]



More information about the R-help mailing list