Ethan Johnsons
2006-Dec-09 17:35 UTC
[R] Error in rmultinom(n, size, prob) : too few positive probabilities
// 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 thx much ej
Uwe Ligges
2006-Dec-09 17:41 UTC
[R] 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 probabilitiesy 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.
Reasonably Related Threads
- rmultinom.c error probability not sum to 1
- Error message for infinite probability parameters in rbinom() and rmultinom()
- Error message for infinite probability parameters in rbinom() and rmultinom()
- Error message for infinite probability parameters in rbinom() and rmultinom()
- Troubles with the function rmultinom.c of the R's Random Number Generator