I'm just starting to experiment with the mgcv package in r. My problem is this - I'm modelling the count of a bird survey in space, with a number of different habitat predictor variables. I have a GAM that has a spatial smooth s(x,y) and then ten parametric linear terms. The GAM takes the form:
~gam(count ~ s(X,Y) A + B + C + D + E + F + G + H + I + J,
offset = log(d),
family = poisson,
link = log)
I have 60 different data sets, each one representing a specific species counts in space over a specific period of time, together with the predictor variables. My objective is to fit a GAM for each dataset, automatically. I want to identify the "best" fit. Having read around a bit, stepwise model selection seems to not be the done thing. Also I'm aware of how smooth terms can be penalised, effectively selecting them out of the fit. But it's not clear how to do this with linear parametric terms. So I'd welcome any methodological advice on how to automate model selection for my particular problem.
Error in if (abs(old.score - score) > score.scale * conv.tol) { : missing value where TRUE/FALSE needed- is this a problem with my data? – Anthony W Jun 24 '20 at 08:09poissondistribution only works with integers. If I change family tofamily = quasipoisson(link="log")the problem goes a way, presumably because this distribution works with continuous numbers. – Anthony W Jun 24 '20 at 08:25Year&Yearrelated terms in the model formula? – Gavin Simpson Jun 25 '20 at 18:58