| Title: | Log-Likelihood Functions for 'rxode2' |
|---|---|
| Description: | Provides the log-likelihoods with gradients from 'stan' (Carpenter et al (2015), <doi:10.48550/arXiv.1509.07164>) needed for generalized log-likelihood estimation in 'nlmixr2' (Fidler et al (2019) <doi:10.1002/psp4.12445>). This is split of to reduce computational burden of recompiling 'rxode2' (Wang, Hallow and James (2016) <doi:10.1002/psp4.12052>) which runs the 'nlmixr2' models during estimation. |
| Authors: | Matthew L. Fidler [aut, cre] (ORCID: <https://orcid.org/0000-0001-8538-6691>) |
| Maintainer: | Matthew L. Fidler <[email protected]> |
| License: | GPL (>= 3) |
| Version: | 2.0.14 |
| Built: | 2026-06-02 06:21:33 UTC |
| Source: | https://github.com/nlmixr2/rxode2ll |
Calculate the log likelihood of the binomial function (and its derivatives)
llikBeta(x, shape1, shape2, full = FALSE)llikBeta(x, shape1, shape2, full = FALSE)
x |
Observation |
shape1, shape2
|
non-negative parameters of the Beta distribution. |
full |
Add the data frame showing x, mean, sd as well as the fx and derivatives |
data frame with fx for the log pdf value of with
dShape1 and dShape2 that has the derivatives with respect to the parameters at
the observation time-point
Matthew L. Fidler
x <- seq(1e-4, 1 - 1e-4, length.out = 21) llikBeta(x, 0.5, 0.5) llikBeta(x, 1, 3, TRUE)x <- seq(1e-4, 1 - 1e-4, length.out = 21) llikBeta(x, 0.5, 0.5) llikBeta(x, 1, 3, TRUE)
Calculate the log likelihood of the binomial function (and its derivatives)
llikBinom(x, size, prob, full = FALSE)llikBinom(x, size, prob, full = FALSE)
x |
Number of successes |
size |
Size of trial |
prob |
probability of success |
full |
Add the data frame showing x, mean, sd as well as the fx and derivatives |
data frame with fx for the pdf value of with
dProb that has the derivatives with respect to the parameters at
the observation time-point
Matthew L. Fidler
llikBinom(46:54, 100, 0.5) llikBinom(46:54, 100, 0.5, TRUE)llikBinom(46:54, 100, 0.5) llikBinom(46:54, 100, 0.5, TRUE)
log likelihood of Cauchy distribution and it's derivatives (from stan)
llikCauchy(x, location = 0, scale = 1, full = FALSE)llikCauchy(x, location = 0, scale = 1, full = FALSE)
x |
Observation |
location, scale
|
location and scale parameters. |
full |
Add the data frame showing x, mean, sd as well as the fx and derivatives |
data frame with fx for the log pdf value of with
dLocation and dScale that has the derivatives with respect to the parameters at
the observation time-point
Matthew L. Fidler
x <- seq(-3, 3, length.out = 21) llikCauchy(x, 0, 1) llikCauchy(x, 3, 1, full=TRUE)x <- seq(-3, 3, length.out = 21) llikCauchy(x, 0, 1) llikCauchy(x, 3, 1, full=TRUE)
log likelihood and derivatives for chi-squared distribution
llikChisq(x, df, full = FALSE)llikChisq(x, df, full = FALSE)
x |
variable that is distributed by chi-squared distribution |
df |
degrees of freedom (non-negative, but can be non-integer). |
full |
Add the data frame showing x, mean, sd as well as the fx and derivatives |
data frame with fx for the log pdf value of with dDf
that has the derivatives with respect to the df parameter
the observation time-point
Matthew L. Fidler
llikChisq(1, df = 1:3, full=TRUE) llikChisq(1, df = 6:9)llikChisq(1, df = 1:3, full=TRUE) llikChisq(1, df = 6:9)
log likelihood and derivatives for exponential distribution
llikExp(x, rate, full = FALSE)llikExp(x, rate, full = FALSE)
x |
variable that is distributed by exponential distribution |
rate |
vector of rates. |
full |
Add the data frame showing x, mean, sd as well as the fx and derivatives |
data frame with fx for the log pdf value of with dRate
that has the derivatives with respect to the rate parameter
the observation time-point
Matthew L. Fidler
llikExp(1, 1:3) llikExp(1, 1:3, full=TRUE)llikExp(1, 1:3) llikExp(1, 1:3, full=TRUE)
log likelihood and derivatives for F distribution
llikF(x, df1, df2, full = FALSE)llikF(x, df1, df2, full = FALSE)
x |
variable that is distributed by f distribution |
df1, df2
|
degrees of freedom. |
full |
Add the data frame showing x, mean, sd as well as the fx and derivatives |
data frame with fx for the log pdf value of with dDf1 and dDf2
that has the derivatives with respect to the df1/df2 parameters at
the observation time-point
Matthew L. Fidler
x <- seq(0.001, 5, length.out = 100) llikF(x^2, 1, 5)x <- seq(0.001, 5, length.out = 100) llikF(x^2, 1, 5)
log likelihood and derivatives for Gamma distribution
llikGamma(x, shape, rate, full = FALSE)llikGamma(x, shape, rate, full = FALSE)
x |
variable that is distributed by gamma distribution |
shape |
this is the distribution's shape parameter. Must be positive. |
rate |
this is the distribution's rate parameters. Must be positive. |
full |
Add the data frame showing x, mean, sd as well as the fx and derivatives |
data frame with fx for the log pdf value of with dProb
that has the derivatives with respect to the prob parameters at
the observation time-point
Matthew L. Fidler
llikGamma(1, 1, 10)llikGamma(1, 1, 10)
log likelihood and derivatives for Geom distribution
llikGeom(x, prob, full = FALSE)llikGeom(x, prob, full = FALSE)
x |
variable distributed by a geom distribution |
prob |
probability of success in each trial. |
full |
Add the data frame showing x, mean, sd as well as the fx and derivatives |
data frame with fx for the log pdf value of with dProb
that has the derivatives with respect to the prob parameters at
the observation time-point
Matthew L. Fidler
llikGeom(1:10, 0.2)llikGeom(1:10, 0.2)
Calculate the log likelihood of the negative binomial function (and its derivatives)
llikNbinom(x, size, prob, full = FALSE)llikNbinom(x, size, prob, full = FALSE)
x |
Number of successes |
size |
Size of trial |
prob |
probability of success |
full |
Add the data frame showing x, mean, sd as well as the fx and derivatives |
data frame with fx for the pdf value of with
dProb that has the derivatives with respect to the parameters at
the observation time-point
Matthew L. Fidler
llikNbinom(46:54, 100, 0.5) llikNbinom(46:54, 100, 0.5, TRUE)llikNbinom(46:54, 100, 0.5) llikNbinom(46:54, 100, 0.5, TRUE)
Calculate the log likelihood of the negative binomial function (and its derivatives)
llikNbinomMu(x, size, mu, full = FALSE)llikNbinomMu(x, size, mu, full = FALSE)
x |
Number of successes |
size |
Size of trial |
mu |
mu parameter for negative binomial |
full |
Add the data frame showing x, mean, sd as well as the fx and derivatives |
data frame with fx for the pdf value of with
dProb that has the derivatives with respect to the parameters at
the observation time-point
Matthew L. Fidler
llikNbinomMu(46:54, 100, 40) llikNbinomMu(46:54, 100, 40, TRUE)llikNbinomMu(46:54, 100, 40) llikNbinomMu(46:54, 100, 40, TRUE)
Log likelihood for normal distribution
llikNorm(x, mean = 0, sd = 1, full = FALSE)llikNorm(x, mean = 0, sd = 1, full = FALSE)
x |
Observation |
mean |
Mean for the likelihood |
sd |
Standard deviation for the likelihood |
full |
Add the data frame showing x, mean, sd as well as the fx and derivatives |
data frame with fx for the pdf value of with dMean and
dSd that has the derivatives with respect to the parameters at
the observation time-point
Matthew L. Fidler
llikNorm(0) llikNorm(seq(-2,2,length.out=10), full=TRUE)llikNorm(0) llikNorm(seq(-2,2,length.out=10), full=TRUE)
log-likelihood for the Poisson distribution
llikPois(x, lambda, full = FALSE)llikPois(x, lambda, full = FALSE)
x |
non negative integers |
lambda |
non-negative means |
full |
Add the data frame showing x, mean, sd as well as the fx and derivatives |
data frame with fx for the pdf value of with
dLambda that has the derivatives with respect to the parameters at
the observation time-point
Matthew L. Fidler
Log likelihood of T and it's derivatives (from stan)
llikT(x, df, mean = 0, sd = 1, full = FALSE)llikT(x, df, mean = 0, sd = 1, full = FALSE)
x |
Observation |
df |
degrees of freedom ( |
mean |
Mean for the likelihood |
sd |
Standard deviation for the likelihood |
full |
Add the data frame showing x, mean, sd as well as the fx and derivatives |
data frame with fx for the log pdf value of with dDf
dMean and dSd that has the derivatives with respect to the parameters at
the observation time-point
Matthew L. Fidler
x <- seq(-3, 3, length.out = 21) llikT(x, 7, 0, 1) llikT(x, 15, 0, 1, full=TRUE)x <- seq(-3, 3, length.out = 21) llikT(x, 7, 0, 1) llikT(x, 15, 0, 1, full=TRUE)
log likelihood and derivatives for Unif distribution
llikUnif(x, alpha, beta, full = FALSE)llikUnif(x, alpha, beta, full = FALSE)
x |
variable distributed by a uniform distribution |
alpha |
is the lower limit of the uniform distribution |
beta |
is the upper limit of the distribution |
full |
Add the data frame showing x, mean, sd as well as the fx and derivatives |
data frame with fx for the log pdf value of with dProb
that has the derivatives with respect to the prob parameters at
the observation time-point
Matthew L. Fidler
llikUnif(1, -2, 2)llikUnif(1, -2, 2)
log likelihood and derivatives for Weibull distribution
llikWeibull(x, shape, scale, full = FALSE)llikWeibull(x, shape, scale, full = FALSE)
x |
variable distributed by a Weibull distribution |
shape, scale
|
shape and scale parameters, the latter defaulting to 1. |
full |
Add the data frame showing x, mean, sd as well as the fx and derivatives |
data frame with fx for the log pdf value of with dProb
that has the derivatives with respect to the prob parameters at
the observation time-point
Matthew L. Fidler
llikWeibull(1, 1, 10)llikWeibull(1, 1, 10)