s-news
[Top] [All Lists]

Re: Understanding of scoping (was problem with stepAIC?)

To: ad@cs.uu.nl
Subject: Re: Understanding of scoping (was problem with stepAIC?)
From: Prof Brian Ripley <ripley@stats.ox.ac.uk>
Date: Sun, 15 Jan 2006 05:16:53 +0000 (GMT)
Cc: s-news@wubios.wustl.edu
In-reply-to: <1769.131.211.81.207.1137166756.squirrel@mail.cs.uu.nl>
References: <1769.131.211.81.207.1137166756.squirrel@mail.cs.uu.nl>
This is a scoping issue.  Assign `data' in frame 1.

stepAIC is support software for a book. This is covered briefly there, and in more detail in the companion volume `S Programming'.

On Fri, 13 Jan 2006 ad@cs.uu.nl wrote:

Dear S users,

I'm working with S-plus 6 under Windows 2000.

I've written the following function just to make clear what
exactly the problem is I'm running in to:

function(data)
{
        fit <- glm(y ~ ., data = data, family = binomial)
        fit2 <- stepAIC(fit)
        fit2
}

When I call this function from the command line (say the function
is called "test"), I get the following error message:

test(somedataset)
Start:  AIC= 701.5
y ~ x1 + x2 + x3 + x4 + x5 + x6 + x7 + x8

Problem in eval(oc, list()): Object "data" not found

When I use traceback, I can see the error is generated by stepAIC
(from the MASS library), but I haven't got a clue what the problem is.
Has anybody got an idea what causes this error, and how it can be solved?

Thanks for your help.

-Ad Feelders
--------------------------------------------------------------------
This message was distributed by s-news@lists.biostat.wustl.edu.  To
unsubscribe send e-mail to s-news-request@lists.biostat.wustl.edu with
the BODY of the message:  unsubscribe s-news


--
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

<Prev in Thread] Current Thread [Next in Thread>
  • problem with stepAIC?, ad
    • Re: Understanding of scoping (was problem with stepAIC?), Prof Brian Ripley <=