7 int b =
static_cast<int>(v);
48 Type
_dtweedie(
const double y, Type& mu, Type& phi, Type& p,
bool give_log) {
49 Type p1 = p - 1.0, p2 = 2.0 - p;
50 Type ans = -
pow(mu, p2) / (phi * p2);
52 ans += tweedie_logW(y, phi, p);
53 ans += -y / (phi * p1 *
pow(mu, p1)) -
log(y);
55 return ( give_log ? ans :
exp(ans) );
Type _dtweedie(const double y, Type &mu, Type &phi, Type &p, bool give_log)
dtweedie function (same as dtweedie.series from R package 'tweedie').
Base class for dvariable.
double gammln(double xx)
Log gamma function.
int imax2(int a, double v)
dvariable lgamma(const prevariable &v)
double fmax2(double a, const dvariable &v)
Author: David Fournier Copyright (c) 2008-2012 Regents of the University of California.
d3_array exp(const d3_array &arr3)
Returns d3_array results with computed exp from elements in arr3.
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.
dvector value(const df1_one_vector &v)
double asDouble(const dvariable &v)
Fundamental data type for reverse mode automatic differentiation.
d3_array log(const d3_array &arr3)
Author: David Fournier Copyright (c) 2008-2012 Regents of the University of California.
d3_array pow(const d3_array &m, int e)
Description not yet available.