Created
February 17, 2016 23:48
-
-
Save tvladeck/d52df2a3c641a996a65a to your computer and use it in GitHub Desktop.
log likelihood of beta nbd model
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
beta.nbd.ll <- function(x, n_x, r, alpha, a, b) | |
{ | |
# params: | |
# x: vector of counts | |
# n_x: number of observations for each count | |
# r, alpha: nbd params | |
# a, b: beta params | |
# output: | |
# the log-likelihood of the model | |
probs <- sapply(x, function(y) beta.nbd.density(y, r, alpha, a, b)) | |
lls <- n_x * log(probs) | |
ll <- sum(lls) | |
return(ll) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment