Gyanendra Pokharel wrote on 11/08/2011 10:57:38 AM:
> 
> Hi R community!
> I am analyzing the data set "motorins" in the package "faraway" by using
> the generalized additive model. it shows the following error. Can some 
one
> suggest me the right way?
> 
> library(faraway)
> data(motorins)
> motori <- motorins[motorins$Zone==1,]
> library(mgcv)
> >amgam <- gam(log(Payment) ~ offset(log(Insured))+
> s(as.numeric(Kilometres)) + s(Bonus) + Make + s(Claims),family = 
gaussian,
> data = motori)
> 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
> > summary(amgam)
> Error in summary(amgam) : object 'amgam' not found
> Gyan


You could try reducing the number of degrees of freedom in the smooth 
terms with the k argument of the s() function:

amgam <- gam(log(Payment) ~ offset(log(Insured))+ 
s(as.numeric(Kilometres), k=3) + 
        s(Bonus, k=3) + Make + s(Claims, k=3), data=motori) 

Jean
	[[alternative HTML version deleted]]

