[R] Intercept=0 in gam from gam package

Gavin Simpson gavin.simpson at ucl.ac.uk
Thu Sep 10 16:25:02 CEST 2009


On Thu, 2009-09-10 at 14:58 +0100, Corrado wrote:
> Dear R list,
> 
> is it possible to force the intercept to assume the value of 0 (that is no 
> intercept) in gam from gam package?

Just like you would in lm or glm for example, by adding -1 to your
formula. ?gam suggests you look at ?lm to see about the formulas for
example.

data(airquality)
mod0 <- gam(Ozone^(1/3) ~ lo(Solar.R) + lo(Wind, Temp) - 1, 
            data = airquality, na = na.gam.replace)
mod1 <- gam(Ozone^(1/3) ~ lo(Solar.R) + lo(Wind, Temp), 
            data = airquality, na = na.gam.replace)

summary(mod0)
summary(mod1)

HTH

G

> 
> Regards
-- 
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%
 Dr. Gavin Simpson             [t] +44 (0)20 7679 0522
 ECRC, UCL Geography,          [f] +44 (0)20 7679 0565
 Pearson Building,             [e] gavin.simpsonATNOSPAMucl.ac.uk
 Gower Street, London          [w] http://www.ucl.ac.uk/~ucfagls/
 UK. WC1E 6BT.                 [w] http://www.freshwaters.org.uk
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%




More information about the R-help mailing list