[R] problem with outer

tuggi tugbagueclue at web.de
Thu Sep 9 00:59:39 CEST 2010


hello,

tank you very very much. it solves my first problem. i hope you can help me
also with the second problem.
it was like this.


p_11=seq(0,1,0.1) 
p_12=seq(0,1,0.1) 
then i get also this error message: 
Error in rmultinom(n - q + 1, size = 1, prob = rbind(p_11, p_12, (1 -  : 
  non-positive probability 

i try to solve this problem with a if  order like this:

p_11=seq(0,1,0.1)
p_12=seq(0,1,0.1)
guete = function(p_11,p_12) { if(p_11+p_12<1)
set.seed(1000)
S_vek=matrix(0,nrow=N,ncol=1)
for(i in 1:N) {
X_0=rmultinom(q-1,size=1,prob=p_0)
X_1=rmultinom(n-q+1,size=1,prob=cbind(p_11,p_12,(1-p_11-p_12)))
N_0=apply(X_0[,(n-2*k-L+1):(n-k-L)],1,sum)
N_1=apply(X_1[,(n-q-k+2):(n-q+1)],1,sum)
S_vek[i]=((sum(((N_1-k*cbind(p_11,p_12,(1-p_11-p_12)))^2)/k*cbind(p_11,p_12,(1-p_11-p_12))))/(sum(((N_0-k*p_0)^2)/k*p_0)))-1
}
1-mean(f_1<=S_vek & S_vek <=f_2)
}


f=outer(p_11,p_12,Vectorize(guete))

but i get the error message:
Error  in rmultinom(n - q + 1, size = 1, prob = cbind(p_11, p_12, (1 -  : 
  non-positive probability.

thank for your helps.
Tuggi 


-- 
View this message in context: http://r.789695.n4.nabble.com/problem-with-outer-tp2532074p2532157.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list