Error in rmultinom(n, size, prob) : too few positive probabilities
Ethan Johnsons wrote:
// R 2.3.1 Can someone please explain why this error returns?
y=numeric(100) x=matrix(runif(16),4,4) for(i in 2:100)
+ {
+ y[i]=which(rmultinom(1, size = 1, prob = x[y[i-1], ])==1)
+ }
Error in rmultinom(n, size, prob) : too few positive probabilities
y is 0, hence prob=x[y[i-1], ] is empty You can try it out step by step yourself. Uwe Ligges
thx much ej
______________________________________________ R-help at stat.math.ethz.ch 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.