[R] problem with outer

tuggi tugbagueclue at web.de
Wed Sep 8 23:33:40 CEST 2010


Hello,

i wrote this function guete and now i want to plot it: but i get this error
message. i hope someone can help me.

Error in dim(robj) <- c(dX, dY) : 
  dims [product 16] do not match the length of object [1]

p_11=seq(0,0.3,0.1)
p_12=seq(0.1,0.4,0.1)
guete = function(p_11,p_12) { 
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)
}

An other problem i have is when i define

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 cannot solve this problem too.

Thank you for your time and sorry for my english. I am from germany.

Tuggi

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



More information about the R-help mailing list