ADMB Documentation  -a65f1c97
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Functions
dtweedie.cpp File Reference

(Last Changed on February 28, 2022 for git-revision a97bb267be466f40e3eae1f645bbfb0f5d6d2602.)

#include <vector>
#include <type_traits>
#include <fvar.hpp>
#include "tweedie_logW.cpp"

Go to the source code of this file.

Functions

template<class Type >
Type _dtweedie (const double y, Type &mu, Type &phi, Type &p, bool give_log)
 dtweedie function (same as dtweedie.series from R package 'tweedie'). More...
 
double asDouble (const dvariable &v)
 
dvariable dtweedie (const double y, dvariable &mu, dvariable &phi, dvariable &p, const bool use_log)
 dtweedie is a wrapper to _dtweedie using ADMB data types. More...
 
double fmax2 (double a, const dvariable &v)
 
int imax2 (int a, double v)
 
int imin2 (int a, int b)
 
dvariable lgamma (const prevariable &v)
 

Function Documentation

template<class Type >
Type _dtweedie ( const double  y,
Type &  mu,
Type &  phi,
Type &  p,
bool  give_log 
)

dtweedie function (same as dtweedie.series from R package 'tweedie').

Silently returns NaN if not within the valid parameter range:

\[ (0 \leq y) \land (0 < \mu) \land (0 < \phi) \land (1 < p) \land (p < 2) \]

.

Note
Parameter order differs from the R version.
Warning
The derivative wrt. the y argument is disabled (zero). Hence the tweedie distribution can only be used for data (not random effects).

The dtweedie function was copied from TMB repository at https://github.com/kaskr/adcomp, then modified for ADMB data types.

Definition at line 48 of file dtweedie.cpp.

Referenced by dtweedie().

double asDouble ( const dvariable v)

Definition at line 19 of file dtweedie.cpp.

dvariable dtweedie ( const double  y,
dvariable mu,
dvariable phi,
dvariable p,
const bool  use_log 
)

dtweedie is a wrapper to _dtweedie using ADMB data types.

Definition at line 59 of file dtweedie.cpp.

double fmax2 ( double  a,
const dvariable v 
)

Definition at line 14 of file dtweedie.cpp.

Referenced by rdqagie(), rdqagse(), rdqelg(), rdqk15i(), and rdqk21().

int imax2 ( int  a,
double  v 
)

Definition at line 5 of file dtweedie.cpp.

int imin2 ( int  a,
int  b 
)

Definition at line 10 of file dtweedie.cpp.

Referenced by rdqk15i().

dvariable lgamma ( const prevariable v)

Definition at line 23 of file dtweedie.cpp.