# p term in Tweedie distribution-DSM

19 views

### Antonella Pane

Sep 12, 2021, 4:29:16 PM9/12/21
to distance-sampling
Hello everybody!

I ran a DSM to study the variables that influence the spatial distribution of territorial ungulates. My models are a mix of smooth terms and parametric (categorical) terms, for example, predation risk level (low/high).

I built base models using negative binomial and Tweedie distributions; then, selected the best model within each distribution and finally selected the best-fitting DSM considering q-q plots and residual diagnostic plots.

I have data from several seasons, so I have one DSM per season. In some cases,  the NB model provided the best fit, and in some other cases, the Tweedie model did.

In a revision, I was asked about how the p term in the Tweedie distribution is tuned. I know that this value is available in the DSM summary but I can't seem to find the math behind it to explain to the reviewer. Related to this, I read that depending on the p term chosen in the Tweedie model, it would be equivalent to the negative binomial (with p=2). In such a case, would the Tweedie model be actually better?

Any help related to this issue would be greatly appreciated!
Thank you!

Sep 13, 2021, 2:38:15 AM9/13/21
to Antonella Pane, distance-sampling
Antonella

A partial answer to your question about the estimation of p in the Tweedie can be found by consulting the documentation for the `mgcv`​ R package

https://cran.r-project.org/web/packages/mgcv/mgcv.pdf

The author of the `mgcv`​ package refers to the literature regarding the computations:

Dunn, P.K. and G.K. Smyth (2005) Series evaluation of Tweedie exponential dispersion model densities. Statistics and Computing 15:267-280

Perhaps others can provide a less clinical answer.
 Package ‘tweedie’ January 20, 2021 Version 2.3.3 Date 2021-01-20 Title Evaluation of Tweedie Exponential Family Models Author Peter K. Dunn [cre, aut]

Sent: 12 September 2021 21:29
Subject: [distance-sampling] p term in Tweedie distribution-DSM

--
You received this message because you are subscribed to the Google Groups "distance-sampling" group.
To unsubscribe from this group and stop receiving emails from it, send an email to distance-sampl...@googlegroups.com.

### Antonella Pane

Sep 13, 2021, 9:37:37 AM9/13/21
to distance-sampling
Eric, Thank you very much for your fast response. I will check these documents.

To add more detail to my question (especially for the second part), the p terms of the Tweedie models I ran ranged between 1.01 and 1.11

### David Lawrence Miller

Sep 13, 2021, 11:06:26 AM9/13/21
to Antonella Pane, distance-sampling
H Antonella, hi listfolk,

Probably a better (though quite technical) reference would be:

Wood, S. N., Pya, N., & Säfken, B. (2016). Smoothing Parameter and Model
Selection for General Smooth Models. Journal of the American Statistical
Association, 111(516), 1548–1563.
https://doi.org/10.1080/01621459.2016.1180986

In particular Appendix J shows the exact technical details for the
Tweedie, based on those in Section 3.3. In practice, mgcv (which does
the hard work inside dsm to fit models) will estimate the Tweedie
parameter while it estimates the other hyperparameters in the model
(like the smoothing parameters, scale parameter etc).

Hope that helps,
--dave

On 13/09/2021 14:37, Antonella Pane wrote:
> Eric, Thank you very much for your fast response. I will check these
> documents.
>
> To add more detail to my question (especially for the second part), the
> p terms of the Tweedie models I ran ranged between 1.01 and 1.11
>
> El lunes, 13 de septiembre de 2021 a las 3:38:15 UTC-3, Eric Rexstad
> escribió:
>
> Antonella
>
> Tweedie can be found by consulting the documentation for the |mgcv|​
> R package
>
> https://cran.r-project.org/web/packages/mgcv/mgcv.pdf
> <https://cran.r-project.org/web/packages/mgcv/mgcv.pdf>
> <https://cran.r-project.org/web/packages/tweedie/tweedie.pdf>
> The author of the |mgcv|​ package refers to the literature regarding
> the computations:
>
> Dunn,P.K.andG.K.Smyth(2005)SeriesevaluationofTweedieexponentialdispersionmodel
> densities. Statistics and Computing 15:267-280
>
> Perhaps others can provide a less clinical answer.
> *MailScanner has detected a possible fraud attempt from
> "cran.r-project.org" claiming to be* Package ‘tweedie’ -
> cran.r-project.org
> <https://cran.r-project.org/web/packages/tweedie/tweedie.pdf>
> Package ‘tweedie’ January 20, 2021 Version 2.3.3 Date 2021-01-20
> Title Evaluation of Tweedie Exponential Family Models Author Peter
> K. Dunn [cre, aut]
> cran.r-project.org <http://cran.r-project.org>
>
> //
>
> ------------------------------------------------------------------------
> on behalf of Antonella Pane <anto...@gmail.com>
> *Sent:* 12 September 2021 21:29
> *Subject:* [distance-sampling] p term in Tweedie distribution-DSM
>
> --
> You received this message because you are subscribed to the Google
> Groups "distance-sampling" group.
> To unsubscribe from this group and stop receiving emails from it, send
> To view this discussion on the web visit

### Antonella Pane

Sep 13, 2021, 5:29:56 PM9/13/21
to distance-sampling
Hi David,

Thank you very much for your reply. The first issue is much clearer now.
What I still don't understand quite well is the relationship between Tweedie and negative binomial distributions, if any. Are these two distributions equivalent in any situation (e.g., when p=2 in Tweedie)?

Thank you very much in advance!

Antonella

### David Lawrence Miller

Sep 16, 2021, 6:26:02 AM9/16/21
to Antonella Pane, distance-sampling
Hi Antonella, hi listfolk,

I find it easier to understand these two distributions in terms of their
mean-variance relationships. For Tweedie

var = scale * mean^p

where p is the "power" parameter and scale is the scale parameter, both
returned in the summary()

Whereas for the negative binomial

var = mean + kappa * mean^2

(I think actually dsm returns theta=1/kappa in summary() but the idea is
the same).

So, in terms of these mean-variance relationships, we can't say that
these are equivalent distributions.

Hope this helps!

cheers,
--dave
> > "cran.r-project.org <http://cran.r-project.org>" claiming to be*
> Package ‘tweedie’ -
> > cran.r-project.org <http://cran.r-project.org>
> > <https://cran.r-project.org/web/packages/tweedie/tweedie.pdf
> <https://cran.r-project.org/web/packages/tweedie/tweedie.pdf>>
> > Package ‘tweedie’ January 20, 2021 Version 2.3.3 Date 2021-01-20
> > Title Evaluation of Tweedie Exponential Family Models Author Peter
> > K. Dunn [cre, aut]
> > cran.r-project.org <http://cran.r-project.org>
> <http://cran.r-project.org <http://cran.r-project.org>>
>
> >
> > --
> > You received this message because you are subscribed to the Google
> > Groups "distance-sampling" group.
> > To unsubscribe from this group and stop receiving emails from it,
> send
> > an email to distance-sampl...@googlegroups.com
> > To view this discussion on the web visit
> >
>
> >
>
>
> --
> You received this message because you are subscribed to the Google
> Groups "distance-sampling" group.
> To unsubscribe from this group and stop receiving emails from it, send
> To view this discussion on the web visit