Re: [R] Probelms on using gam(mgcv)

From: Simon Wood <sw283_at_maths.bath.ac.uk>
Date: Thu, 13 Dec 2007 12:04:13 +0000 (GMT)

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::
> ::\_)::(..)::
> :::::::)./:::
> ::::::(_/::::
> :::::::::::::
>



R-help_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. Received on Thu 13 Dec 2007 - 12:09:12 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Thu 13 Dec 2007 - 13:30:19 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.