Type unique(density)
How many different unique values does density take? The wiggliness of the
smooth term consumes degrees of freedom. That is, the more wiggly your
smooth term, the more DFs it consumes. If you get the error you got, you
have to reduce the degrees of freedom alloted to the smooth term manually.
See ?gam
If however, the unique levels of density are very few, then gam may not be
the right way to take anyway.
Da.
-------------------------
cuncta stricte discussurus
-------------------------
-----Urspr?ngliche Nachricht-----
Von: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org] Im
Auftrag von Las dA
Gesendet: Wednesday, March 04, 2009 1:04 PM
An: r-help at r-project.org
Betreff: [R] help with GAM
Hi
I'm trying to do a GAM analysis and have the following codes entered into R
(density is = sample number, alive are the successes)
density<-as.real(density)
y<-cbind(alive,density-alive)
library(mgcv)
m1<-gam(y~s(density),binomial)
at which point I get the following error 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
What am I doing wrong? Please help!
Thanks!
______________________________________________
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.