# [R] help

thanoon younis thanoon.younis80 at gmail.com
Fri Sep 18 12:04:01 CEST 2015

```Hi,

I need you help to correct the code below please
I have this error
Error in if (v[j] >= 0) yo[i, j] <- 1 else yo[i, j] <- 0 :
missing value where TRUE/FALSE needed

N<-200;P<-9
W=matrix(NA, nrow=N, ncol=2)
xi=matrix(NA, nrow=N, ncol=2)
Eta=numeric(N)
phi<-matrix(data=c(1.0,0.3,0.3,1.0),ncol=2)
yo<-matrix(data=NA,nrow=N1,ncol=P); p<-numeric(P); v<- numeric(P)
for (t in 1:25) {
for (i in 1:N) {
xi1[i,]=rmvnorm(1, c(0,0), phi)
delta1<-rnorm(1,0,sqrt(0.3))
eps<-rnorm(3,0,1)

Eta[i]=0.6*W[i,1]+0.6*W[i,1]*xi[i,1]+0.6*W[i,2]*xi[i,2]+0.6*W[i,2]*xi[i,2]*xi[i,2]+0.6*xi[i,1]+0.6*xi[i,2]+0.6*xi[i,1]*xi[i,1]+delta
v[1]<-1.0+xi[i,1]; v1[2]<-1.0+0.8*xi1[i,1]; v1[3]<- 1.0+0.8*xi1[i,1]
v[4]<-1.0+xi[i,2]; v1[5]<-1.0+0.8*xi1[i,2]; v1[6]<- 1.0+0.8*xi1[i,2]
v[7]<-1.0+Eta[i]+eps[1]; v[8]<-1.0+0.8*Eta[i]+eps[2];
v[9]<-1.0+0.8*Eta[i]+eps[3]

for (j in 1:9) { if (v[j]>=0) yo[i,j]<-1 else yo[i,j]<-0 } }

}#end

Any help would be 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