Solved – Which distribution should I use when building a GAM in R

distributionsf distributiongeneralized-additive-modelpoisson distributionr

What type of distribution would you consider this data to be? My first thought is an f-distribution, but I suppose it could also be a poisson distribution. I am trying to build a generalized additive model (gam) that takes time compnents of an EMS call (things like response time, time at scene, time to hospital, etc.) to see how well specific parts of an EMS run can explain the overall call time.

The gam function in R (using the mgcv package) uses family=" " to identify the distribution of the gam. The f-distribution is not a family type. Does anyone know why not? Should I go with the poisson distribution? That said, I have tried both gaussian and poisson in test gam models. I had a deviance explained = ~70% for the gaussian gam and only deviance explained = ~50% for the poisson. Should I go with whichever distribution gives me the higher deviance explained value? Thanks!

enter image description here

Best Answer

What type of distribution would you consider this data to be?

it's largely irrelevant what that looks like, since you have here the marginal distribution, but the GAM will be modelling the conditional distributions (conditional on the predictors, that is).

My first thought is an f-distribution, but I suppose it could also be a poisson distribution.

If it could be one, it could not possibly be the other, since one is continuous and the other is discrete. But again, it doesn't matter for this problem.

The f-distribution is not a family type. Does anyone know why not?

Because the F is not exponential-family.

If there's a strong need for an F, there are other things you might try (but I see no reason to think that there is any need for an F at all, other than a very superficial similarity of the - irrelevant - shape of the marginal distribution).

Should I go with the poisson distribution?

I don't see why this would be a reasonable choice. Times aren't discrete. Even if that wasn't an issue, I see no reason to expect that the variance will be equal to the mean. Indeed, since you'd expect the spread-mean relationship not to depend on your time-unit, I'd plump for variance proportional to mean-squared (which suggests Gamma or lognormal as two easy options)

My first choice for times would typically be Gamma, with either a log link or an inverse link (or rarely, perhaps identity), depending on my understanding of the circumstances. In some circumstances I might transform times (to speeds or log-times) and try to model those.

There are other possibilities - inverse-Gaussian or Tweedie**, for example

**(not available by default, but there's a package that should make it work with GLMs and GAMs)