s-news
[Top] [All Lists]

problem with stepAIC?

To: s-news@wubios.wustl.edu
Subject: problem with stepAIC?
From: ad@cs.uu.nl
Date: Fri, 13 Jan 2006 16:39:16 +0100 (CET)
Importance: Normal
User-agent: SquirrelMail/1.4.5-1
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

<Prev in Thread] Current Thread [Next in Thread>