[R-sig-eco] gam

Bob O'Hara bohara at senckenberg.de
Thu May 17 19:44:30 CEST 2012


On 05/17/2012 06:17 PM, Mahnaz Rabbaniha wrote:
> Dear all
>
> i have done GAM for data ( they are non- normal and i find regression
> between Sillaginidae with several hydrological factors),i done :
>
> [1] "depth"        "temperature"  "salinity"     "Sillaginidae"
>
>   >  pairs(sc,panel=function(x,y){points(x,y);lines(lowess(x,y))})
>
>> model<-gam(Sillaginidae~s(temperature)+s(salinity)+s(depth))
> but i take this message:
>
> Error in smooth.construct.tp.smooth.spec(object, dk$data, dk$knots) :
>    A term has fewer unique covariate combinations than specified
> maximum degrees of freedom
>
>
> please help me what can i do? or what is meaning this sentence?
It means that you don't have a lot of different values for one of your 
covariates. You can check which with

length(unique(depth))
length(unique(temperature))
length(unique(salinity))

Unless you have a lot of data, that the sensible thing to is probably to 
fit a straight line rather than a smooth curve. The other thing to do is 
to define the maximum flexibility of the curve, e.g.

model<-gam(Sillaginidae~s(temperature, k=6)+s(salinity)+s(depth))

I hope this helps.

Bob

-- 
Bob O'Hara

Biodiversity and Climate Research Centre
Senckenberganlage 25
D-60325 Frankfurt am Main,
Germany

Tel: +49 69 798 40226
Mobile: +49 1515 888 5440
WWW:   http://www.bik-f.de/root/index.php?page_id=219
Blog: http://blogs.nature.com/boboh
Journal of Negative Results - EEB: www.jnr-eeb.org



More information about the R-sig-ecology mailing list