On Tue, 5 Nov 2002, Murray Jorgensen wrote:
> I'm having a bit of difficulty using the stepwise model-building tools
> in a glm context. Here, for example is one problem I have had using
> add1, where the abbreviation "." does not work as I expected it
to do. I
What did you expect?  `.' means `what is already there' in updating a
formula, so you asked for nothing to be added.  The help page says
   scope: a formula giving the terms to be considered for adding or
          dropping.
and that seems precise to me.
> someone could point me towards some examples involving the interactive
> building of glm models I would be grateful.
Chapter 7 of MASS has examples using addterm, and add1 is a cut-down
version of addterm.
> The data set that I am using is the "Student's Goals" dataset
from DASL.
>
>  > goals.df <-read.table("C:\\Data\\DASL\\goals.txt",
header = TRUE)
>  > goals.df <- goals.df[,2:8]
>  > goals.df[1:3,]
>    Gender Grade Res Goals MOST LEAST Count
> 1      1     4   1     1    2     1     1
> 2      1     4   1     1    2     3     1
> 3      1     4   1     2    1     3     1
>  > const <-glm(formula=Count~1,family = poisson(link =
"log"),
> data=goals.df)
>  > add1(const, Count ~ .)
> Error in if (ncol(add) > 1) { : missing value where logical needed
(That's a micro-bug)
>  > add1(const, ~ Gender+Grade+Res+Goals+MOST+LEAST)
> Single term additions
>
> Model:
> Count ~ 1
>         Df Deviance    AIC
> <none>      214.03 770.85
> Gender  1   212.72 771.55
> Grade   1   206.96 765.79
> Res     1   213.25 772.08
> Goals   1   208.33 767.16
> MOST    1   211.30 770.13
> LEAST   1   208.71 767.54
-- 
Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272860 (secr)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at
stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._