Package 'rxode2ll'

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]
Maintainer: Matthew L. Fidler <[email protected]>
License: GPL (>= 3)
Version: 2.0.12
Built: 2024-11-25 16:30:52 UTC
Source: CRAN

Help Index


Calculate the log likelihood of the binomial function (and its derivatives)

Description

Calculate the log likelihood of the binomial function (and its derivatives)

Usage

llikBeta(x, shape1, shape2, full = FALSE)

Arguments

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

Value

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

Author(s)

Matthew L. Fidler

Examples

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)

Description

Calculate the log likelihood of the binomial function (and its derivatives)

Usage

llikBinom(x, size, prob, full = FALSE)

Arguments

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

Value

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

Author(s)

Matthew L. Fidler

Examples

llikBinom(46:54, 100, 0.5)

llikBinom(46:54, 100, 0.5, TRUE)

log likelihood of Cauchy distribution and it's derivatives (from stan)

Description

log likelihood of Cauchy distribution and it's derivatives (from stan)

Usage

llikCauchy(x, location = 0, scale = 1, full = FALSE)

Arguments

x

Observation

location, scale

location and scale parameters.

full

Add the data frame showing x, mean, sd as well as the fx and derivatives

Value

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

Author(s)

Matthew L. Fidler

Examples

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

Description

log likelihood and derivatives for chi-squared distribution

Usage

llikChisq(x, df, full = FALSE)

Arguments

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

Value

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

Author(s)

Matthew L. Fidler

Examples

llikChisq(1, df = 1:3, full=TRUE)

llikChisq(1, df = 6:9)

log likelihood and derivatives for exponential distribution

Description

log likelihood and derivatives for exponential distribution

Usage

llikExp(x, rate, full = FALSE)

Arguments

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

Value

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

Author(s)

Matthew L. Fidler

Examples

llikExp(1, 1:3)

llikExp(1, 1:3, full=TRUE)

log likelihood and derivatives for F distribution

Description

log likelihood and derivatives for F distribution

Usage

llikF(x, df1, df2, full = FALSE)

Arguments

x

variable that is distributed by f distribution

df1, df2

degrees of freedom. Inf is allowed.

full

Add the data frame showing x, mean, sd as well as the fx and derivatives

Value

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

Author(s)

Matthew L. Fidler

Examples

x <- seq(0.001, 5, length.out = 100)

llikF(x^2, 1, 5)

log likelihood and derivatives for Gamma distribution

Description

log likelihood and derivatives for Gamma distribution

Usage

llikGamma(x, shape, rate, full = FALSE)

Arguments

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

Value

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

Author(s)

Matthew L. Fidler

Examples

llikGamma(1, 1, 10)

log likelihood and derivatives for Geom distribution

Description

log likelihood and derivatives for Geom distribution

Usage

llikGeom(x, prob, full = FALSE)

Arguments

x

variable distributed by a geom distribution

prob

probability of success in each trial. 0 < prob <= 1.

full

Add the data frame showing x, mean, sd as well as the fx and derivatives

Value

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

Author(s)

Matthew L. Fidler

Examples

llikGeom(1:10, 0.2)

Calculate the log likelihood of the negative binomial function (and its derivatives)

Description

Calculate the log likelihood of the negative binomial function (and its derivatives)

Usage

llikNbinom(x, size, prob, full = FALSE)

Arguments

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

Value

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

Author(s)

Matthew L. Fidler

Examples

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)

Description

Calculate the log likelihood of the negative binomial function (and its derivatives)

Usage

llikNbinomMu(x, size, mu, full = FALSE)

Arguments

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

Value

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

Author(s)

Matthew L. Fidler

Examples

llikNbinomMu(46:54, 100, 40)

llikNbinomMu(46:54, 100, 40, TRUE)

Log likelihood for normal distribution

Description

Log likelihood for normal distribution

Usage

llikNorm(x, mean = 0, sd = 1, full = FALSE)

Arguments

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

Value

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

Author(s)

Matthew L. Fidler

Examples

llikNorm(0)

llikNorm(seq(-2,2,length.out=10), full=TRUE)

log-likelihood for the Poisson distribution

Description

log-likelihood for the Poisson distribution

Usage

llikPois(x, lambda, full = FALSE)

Arguments

x

non negative integers

lambda

non-negative means

full

Add the data frame showing x, mean, sd as well as the fx and derivatives

Value

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

Author(s)

Matthew L. Fidler


Log likelihood of T and it's derivatives (from stan)

Description

Log likelihood of T and it's derivatives (from stan)

Usage

llikT(x, df, mean = 0, sd = 1, full = FALSE)

Arguments

x

Observation

df

degrees of freedom (>0> 0, maybe non-integer). df = Inf is allowed.

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

Value

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

Author(s)

Matthew L. Fidler

Examples

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

Description

log likelihood and derivatives for Unif distribution

Usage

llikUnif(x, alpha, beta, full = FALSE)

Arguments

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

Value

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

Author(s)

Matthew L. Fidler

Examples

llikUnif(1, -2, 2)

log likelihood and derivatives for Weibull distribution

Description

log likelihood and derivatives for Weibull distribution

Usage

llikWeibull(x, shape, scale, full = FALSE)

Arguments

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

Value

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

Author(s)

Matthew L. Fidler

Examples

llikWeibull(1, 1, 10)