Skip to content

Instantly share code, notes, and snippets.

View jeanbaptisteb's full-sized avatar

Jean-Baptiste Bertrand jeanbaptisteb

  • CNRS
View GitHub Profile
@slwu89
slwu89 / categoricalMLE.R
Created May 25, 2017 00:36
how to do MLE of multinomial distribution for categorical data
###############################################################
#
# MLE example with categorical data
#
###############################################################
# make up some 'data'; c(0.1,0.2,0.3,0.4) are the 'real' parameters
data = rmultinom(n = 40,size = 4,prob = c(0.1,0.2,0.3,0.4))
# the log-likelihood of the first sample