[R] Probelms on using gam(mgcv)

Simon Wood sw283 at maths.bath.ac.uk
Thu Dec 13 13:04:13 CET 2007


A smooth of `disbinary' doesn't really make sense. It should enter the 
model parametrically. The problem is easy to see in 1D. Consider the 
model
y_i = f(x_i) + error_i
where `f' is a smooth function. If x_i only takes the values 0 and 1 
then you really don't have much of a basis for estimating f.


>- Simon Wood, Mathematical Sciences, University of Bath, Bath BA2 7AY
>-             +44 (0)1225 386603         www.maths.bath.ac.uk/~sw283/


On Thu, 13 Dec 2007, zhijie zhang wrote:

> Dear all,
>   Following the help from gam(mgcv) help page, i tried to analyze my
> dataset with all the default arguments. Unfortunately, it can't be run
> successfully. I list the errors below.
>
> #m.gam<-gam(mark~s(x,y)+s(lstday2004)+s(slope)+s(ndvi2004)+s(elevation)+s(disbinary),family=binomial(logit),data=point)
>
> m.gam<-gam(mark~s(x,y,k=10)+s(lstday2004,k=10)+s(slope,k=10)+s(ndvi2004,k=10)+s(elevation,k=10)+s(disbinary,k=10),family=binomial(logit),data=point)
>
>> m.gam<-gam(mark~s(x.1,y.1,k=10)+s(lstday2004,k=10)+s(slope,k=10)+s(ndvi2004,k=10)+s(elevation,k=10)+s(disbinary,k=10),family=binomial(logit),data=point)
> #??????
> Errors: smooth.construct.tp.smooth.spec(object, data, knots) :
>  A term has fewer unique covariate combinations than specified maximum
> degrees of freedom.
>
> #========================#
>  Descriptions for my dataset
> #========================#
>  There are 1 response variable "mark" (1-case,0-control), and 7 explanatory
> covariables.
> x/y are spatial coordinates,
> lstday2004, slope, ndvi2004, elevation: continuous variables;
> disbinary : binary variable.
>  Is there any problems with the above codes? How should i solve it?
>  Any help or suggestions are greatly appreciated.
> -- 
> With Kind Regards,
>
> oooO:::::::::
> (..):::::::::
> :\.(:::Oooo::
> ::\_)::(..)::
> :::::::)./:::
> ::::::(_/::::
> :::::::::::::
> [***********************************************************************]
> Zhi Jie,Zhang ,PHD
> Tel:+86-21-54237149
> Dept. of Epidemiology,School of Public Health,Fudan University
> Address:No. 138 Yi Xue Yuan Road,Shanghai,China
> Postcode:200032
> Email:epistat at gmail.com
> Website: www.statABC.com <http://www.statabc.com/>
> [***********************************************************************]
> oooO:::::::::
> (..):::::::::
> :\.(:::Oooo::
> ::\_)::(..)::
> :::::::)./:::
> ::::::(_/::::
> :::::::::::::
>



More information about the R-help mailing list