On Sun, 15 Jan 2006 ad@cs.uu.nl wrote:
Dear S users,
Thanks to everyone who responded to my question (reproduced at
the end of this message). As it turns out it was not a problem
with stepAIC, but with my understanding of the S scoping rules.
Two solutions were suggested to me, both of which solved the
problem. The first is to assign "data" to frame 1, using
assign("data",data,frame=1). The other solution also works but
I don't know why: change the call to glm to
fit <- do.call("glm", list(fo = y ~ ., data = data, family = binomial))
That embeds the (deparsed) actual data in the call component of the object
'fit'. The deparse/parse steps could involve subtle changes due to
representation errors, and it is certainly slow for large datasets.
--
Brian D. Ripley, ripley@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
|