[R] gam questions
Henric Nilsson
henric.nilsson at statisticon.se
Tue Jun 3 10:22:15 CEST 2003
Dear all,
I'm a fairly new R user having two questions regarding gam:
1. The prediction example on p. 38 in the mgcv manual. In order to get
predictions based on the original data set, by leaving out the 'newdata'
argument ("newd" in the example), I get an error message
"Warning message: the condition has length > 1 and only the first element
will be used in: if (object$dim == 0) m <- 0 else m <- length(object$sp)"
I suspected that it had somthing to do with the data not being attached,
but when fitting a gam with an attached data set I got the same error. Why?
2. I've fitted a glm y~a+x+a:x, where a is a 3 level factor and x is a
continuous covariate. If I want to fit a similar gam model, is it correct
to fit y~a+s(x)+s(x,by=a.1)+s(x,by=a.2)+s(x,by=a.3), where a.1--a.3 are
dummy variables representing each level of the factor? Or is the s(x) term
redundant?
Any hints are greatly appreciated.
Best wishes,
Henric
---------------------------------------------------------------------------------------
Henric Nilsson, Statistician
Statisticon AB, Östra Ågatan 31, SE-753 22 UPPSALA
Phone (Direct): +46 (0)18 18 22 37
Mobile: +46 (0)70 211 68 36
Fax: +46 (0)18 18 22 33
<http://www.statisticon.se>
More information about the R-help
mailing list