Calculate the log likelihood of the negative binomial function (and its derivatives)
llikNbinom(x, size, prob, full = FALSE)
x
: Number of successessize
: Size of trialprob
: probability of successfull
: Add the data frame showing x, mean, sd as well as the fx and derivativesdata frame with fx
for the pdf value of with dProb
that has the derivatives with respect to the parameters at the observation time-point
In an rxode2()
model, you can use llikNbinom()
but you have to use all arguments. You can also get the derivative of prob
with llikNbinomDprob()
llikNbinom(46:54, 100, 0.5) llikNbinom(46:54, 100, 0.5, TRUE) # In rxode2 you can use: et <- et(46:54) et$size <- 100 et$prob <-0.5 model <- function() { model({ fx <- llikNbinom(time, size, prob) dProb <- llikNbinomDprob(time, size, prob) }) } rxSolve(model, et)
Matthew L. Fidler
Useful links