The function dmultinom (x, size = NULL, prob, log = FALSE) estimate probabilities of a Multinomial distribution. However, it does not run with size =1.
Theoretically, when setting size=1 the Multinomial distribution should be equivalent to the Categorical distribution.
Does anybody know why the error message?
FYI, Categorical distribution can be modelled by dist.Categorical {LaplacesDemon}.
Examples:
dmultinom(c(1,2,1),size = 1,prob = c(0.3,0.5,0.4))
Error in dmultinom(c(1, 2, 1), size = 1, prob = c(0.3, 0.5, 0.4)) : size != sum(x)
dcat(c(1,2,1),p = c(0.3,0.5,0.4))
[1] 0.3 0.5 0.3
Thanks