[R] knots fixed in gam(), library(mgcv)

Tord Snall tord.snall at ebc.uu.se
Mon May 26 10:28:28 CEST 2003

Dear all,

I have a problem with specifying the no. of knots in our function which
include gam(). I last worked with this in mid September but since then I
have reinstalled R and Simon Wood's library(mgcv), which he has changed
since then. The statistician (and good R-coder) with whom I co-operate is
now unfortunately overloaded with teaching, and I'm in the sprut of my
thesis.... I therefore would be really happy for help in solving this

The problem is then the way we specify the no of knots in the gam, I think.

This is part of our function which worked fine in mid September: 

    fsp <- update.formula(formula, ~ . + s(d))
    fsp <- substitute(form+s(d,kn|f),list(kn=knots, form=formula))
    fsp <- as.formula(deparse(fsp))
  fit <- gam(fsp, data = data, ...)

When I do not use the argument "knots" the function still works fine, but
when I do, I get the error message:

Error in (kinship ~ 1) + s(d, 10 | f) : non-numeric argument to binary

I have tried changing the line with substitute() based on what is written
in ?gam but I mostly get the error message Error in terms.formula(gf,
specials = c("s")) 

Could someone please give a hint.

Thanks in advance!

Tord Snäll

Tord Snäll
Avd. f växtekologi, Evolutionsbiologiskt centrum, Uppsala universitet
Dept. of Plant Ecology, Evolutionary Biology Centre, Uppsala University
Villavägen 14			
SE-752 36 Uppsala, Sweden
Tel: 018-471 28 82 (int +46 18 471 28 82) (work)
Tel: 018-25 71 33 (int +46 18 25 71 33) (home)
Fax: 018-55 34 19 (int +46 18 55 34 19) (work)
E-mail: Tord.Snall at ebc.uu.se
Check this: http://www.vaxtbio.uu.se/resfold/snall.htm!

More information about the R-help mailing list