[R-sig-eco] Error message in GAM

Gavin Simpson gavin.simpson at ucl.ac.uk
Wed May 18 18:48:04 CEST 2011


On Wed, 2011-05-18 at 10:53 -0500, ARISTIDES LOPEZ wrote:
> Dear members list,
> 
> I'm trying to make a model for descrive the distribution of demersal fishes
> in the Colombian Caribbean Sea. I have a data set of n= 56, the model is
> like this: Density (ind/km2) ~ s(Lat) + s(Long) + s(deep). The problem is
> that R give me the error message *"Model has more coefficients than data"*.
> 
> Anybody knows how can avoid this?
> 
> Faithfully.

Each of your smooths will be using k = 10 degrees of freedom so that is
30 degrees of freedom already, which is a lot for a data set of 56
observations.

Are all the data unique? i.e. you have 56 unique density values, 56
unique lats, 56 unique lons etc. If not, it might be the the unique
information in the data is not sufficient to support the complexity of
the smooths.

My money would be on that you did something you haven't actually told
us, and have more smooths in the model than you say and they are using
more degrees of freedom than it appears to us.

The easy way to try to solve the problem, will be to restrict the
complexity of the individual smooths:

response ~ s(Lat, k = 6) + s(Long, k = 6) + s(deep, k = 6)

for example.

You could probably model these data as a Possion with an offset term for
the km2 covered by each sample, rather than treating these as a density.

HTH,

G

-- 
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%
 Dr. Gavin Simpson             [t] +44 (0)20 7679 0522
 ECRC, UCL Geography,          [f] +44 (0)20 7679 0565
 Pearson Building,             [e] gavin.simpsonATNOSPAMucl.ac.uk
 Gower Street, London          [w] http://www.ucl.ac.uk/~ucfagls/
 UK. WC1E 6BT.                 [w] http://www.freshwaters.org.uk
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%



More information about the R-sig-ecology mailing list