ldTweedie package:mgcv R Documentation _L_o_g _T_w_e_e_d_i_e _d_e_n_s_i_t_y _e_v_a_l_u_a_t_i_o_n _D_e_s_c_r_i_p_t_i_o_n: A function to evaluate the log of the Tweedie density for variance powers between 1 and 2, inclusive. Also evaluates first and second derivatives of log density w.r.t. its scale parameter. _U_s_a_g_e: ldTweedie(y,mu=y,p=1.5,phi=1) _A_r_g_u_m_e_n_t_s: y: values at which to evaluate density. mu: corresponding means (either of same length as 'y' or a single value). p: the variance of 'y' is proportional to its mean to the power 'p'. 'p' must be between 1 and 2. 1 is Poisson like (exactly Poisson if 'phi=1'), 2 is gamma. phi: The scale parameter. Variance of 'y' is 'phi*mu^p'. _D_e_t_a_i_l_s: A Tweedie random variable with 11.1 is OK y <- seq(1e-10,10,length=1000) p <- c(1.0001,1.001,1.01,1.1,1.2,1.5,1.8,2) phi <- .5 fy <- exp(ldTweedie(y,mu=2,p=p[1],phi=phi)[,1]) plot(y,fy,type="l",ylim=c(0,3),main="Tweedie density as p changes") for (i in 2:length(p)) { fy <- exp(ldTweedie(y,mu=2,p=p[i],phi=phi)[,1]) lines(y,fy,col=i) }