Skip to content
Back to formatted view

Raw Message

Message-ID: <5.2.1.1.0.20030603091708.03e92720@pop3.norton.antivirus>
Date: 2003-06-03T08:22:15Z
From: Henric Nilsson
Subject: gam questions

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>