[R] adding variable

Prof Brian Ripley ripley at stats.ox.ac.uk
Tue Nov 18 19:32:28 CET 2003


On Tue, 18 Nov 2003, Martin Wegmann wrote:

> I have count data of animals (here y, y1, y2...) and env. variables (x, x1, 
> x2 ,....).
> 
> I used a glm 
> 
> glm(y~x1+x2+x3....)
> 
> glm(y1~x1+x2+x3....)
> 
> and now I would like to add the count data of other species to investigate if 
> they might have a bigger impact than the env. variables:
> 
> #x? are the selected var from the first glm run
> 
> glm(y~x?+x?+y1)
> 
> glm(y~x?+x?+x?+y2)
> 
> ....
> 
> I wonder if there is a more elegant method to do this than adding (and 
> removing) each y by hand. 

Do you mean each x?  In either case, see ?update.

-- 
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 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595




More information about the R-help mailing list