[R] dmultinomial
Alexander Shenkin
ashenkin at ufl.edu
Thu Nov 18 18:09:55 CET 2010
Hello All,
I'm trying to run a maximum likelihood analysis using dmultinomial (i'm
avoiding dmultinom as I'd like to run it with vectors for the ML stuff).
However, I'm having a hard time getting even the simplest example
running. Any help would be greatly appreciated.
> library(mc2d)
> dmultinomial(x=c(0,0,1),prob=c(1,1,1),size=1,log=TRUE)
Error in if (ncol(x) != K) stop("x[] and prob[] must be equal length
vectors or equal col matrix.") :
argument is of length zero
# Once I get the simple stuff above running, I'd like to be able to do
the following:
> testmat=rmultinomial(4, 1, prob)
> testmat
[,1] [,2] [,3]
[1,] 1 0 0
[2,] 0 0 1
[3,] 0 0 1
[4,] 0 0 1
> dmultinomial(x=testmat,prob=prob,size=1,log=TRUE)
Error in if (!is.null(size) && nrow(size) != n) size <- matrix(t(size), :
missing value where TRUE/FALSE needed
thanks,
allie
More information about the R-help
mailing list