Displaying 20 results from an estimated 226 matches for "stepaic".
2003 Aug 04
1
Error in calling stepAIC() from within a function
Hi,
I am experiencing a baffling behaviour of stepAIC(),
and I hope to get any advice/help on what went wrong
or I'd missed. I greatly appreciate any advice given.
I am using stepAIC() to, say, select a model via
stepwise selection method.
R Version : 1.7.1
Windows ME
Many thanks and best regards,
Siew-Leng
***Issue :
When step...
2017 Aug 22
4
boot.stepAIC fails with computed formula
I'm trying to use boot.stepAIC for feature selection; I need to be able to specify the name of the dependent variable programmatically, but this appear to fail:
In R-Studio with MS R Open 3.4:
library(bootStepAIC)
#Fake data
n<-200
x1 <- runif(n, -3, 3)
x2 <- runif(n, -3, 3)
x3 <- runif(n, -3, 3)
x4 <- runif(n...
2006 Oct 11
1
Bug in stepAIC?
Hi,
First of all, thanks for the great work on R in general, and MASS in
particular. It's been a life saver for me many times.
However, I think I've discovered a bug. It seems that, when I use
weights during an initial least-squares regression fit, and later try to
add terms using stepAIC(), it uses the weights when looking to remove
terms, but not when looking to add them:
hills.lm <- lm(time ~ dist + climb, data = hills, weights = 1/dist2)
small.hills.lm <- stepAIC(hills.lm)
stepAIC(small.hills.lm, time ~ dist + climb)
In the first stepAIC(), it says that the AIC for the...
2017 Jun 08
1
stepAIC() that can use new extractAIC() function implementing AICc
I would like test AICc as a criteria for model selection for a glm using
stepAIC() from MASS package.
Based on various information available in WEB, stepAIC() use
extractAIC() to get the criteria used for model selection.
I have created a new extractAIC() function (and extractAIC.glm() and
extractAIC.lm() ones) that use a new parameter criteria that can be AIC,
BIC or AICc...
2003 May 02
2
stepAIC/lme (1.6.2)
Based on the stepAIC help, I have assumed that it only was for lm, aov, and
glm models. I gather from the following correspondence that it also works
with lme models.
Thomas Lumley 07:40 a.m. 28/04/03 -0700 4 Re: [R] stepAIC/lme problem
(1.7.0 only)
Prof Brian Ripley 04:19 p.m. 28/04/03 +0100 6 Re: [R] stepAIC/lm...
2009 May 05
2
Stepwise logistic Regression with significance testing - stepAIC
Hello R-Users,
I have one binary dependent variable and a set of independent variables (glm(formula,…,family=”binomial”) ) and I am using the function stepAIC (“MASS”) for choosing an optimal model. However I am not sure if stepAIC considers significance properties like Likelihood ratio test and Wald test (see example below).
> y <- rbinom(30,1,0.4)
> x1 <- rnorm(30)
> x2 <- rnorm(30)
> x3 <- rnorm(30)
> xdata <- data.fr...
2017 Aug 22
1
boot.stepAIC fails with computed formula
...rt <- lm(y1 ~ ., data = dat)
and you do not need to explicitly specify the "1+" on the rhs for lm, so
> frm2<-as.formula(paste(trg," ~ ", paste(xvars,collapse = "+")))
works fine, too.
Anyway, doing this gives (but see end of output)"
bst <- boot.stepAIC(strt,data =
dat,B=50,alpha=0.05,direction='forward',steps=limit,
scope=list(lower=frm1,upper=frm2))
> bst
Summary of Bootstrapping the 'stepAIC()' procedure for
Call:
lm(formula = y1 ~ ., data = dat)
Bootstrap samples: 50
Direction: forward
Penalty: 2 * df...
2006 Apr 07
1
how to run stepAIC starting with NULL model?
Hello,
I'm trying to figure out how to run the stepAIC function starting with the
NULL model. I can call the null model (e.g., lm(y ~ NULL)), but using
this object in stepAIC doesn't seem to work.
The objective is to calculate AICc. This can be done if stepAIC can be
run starting with the NULL model; the (2p(p-1)/(n-p-1))to get AICc would
be add...
2017 Aug 22
1
boot.stepAIC fails with computed formula
...with having an open mind is that people keep coming along
and sticking things into it."
-- Opus (aka Berkeley Breathed in his "Bloom County" comic strip )
On Tue, Aug 22, 2017 at 8:17 AM, Stephen O'hagan
<SOhagan at manchester.ac.uk> wrote:
> I'm trying to use boot.stepAIC for feature selection; I need to be able to specify the name of the dependent variable programmatically, but this appear to fail:
>
> In R-Studio with MS R Open 3.4:
>
> library(bootStepAIC)
>
> #Fake data
> n<-200
>
> x1 <- runif(n, -3, 3)
> x2 <- runif(n, -3...
2017 Aug 22
0
boot.stepAIC fails with computed formula
...people keep coming along
> and sticking things into it."
> -- Opus (aka Berkeley Breathed in his "Bloom County" comic strip )
>
>
> On Tue, Aug 22, 2017 at 8:17 AM, Stephen O'hagan
> <SOhagan at manchester.ac.uk> wrote:
>> I'm trying to use boot.stepAIC for feature selection; I need to be able to specify the name of the dependent variable programmatically, but this appear to fail:
>>
>> In R-Studio with MS R Open 3.4:
>>
>> library(bootStepAIC)
>>
>> #Fake data
>> n<-200
>>
>> x1 <- runif...
2003 Apr 28
2
stepAIC/lme problem (1.7.0 only)
I can use stepAIC on an lme object in 1.6.2, but
I get the following error if I try to do the same
in 1.7.0:
Error in lme(fixed = resp ~ cov1 + cov2, data = a, random = structure(list( :
unused argument(s) (formula ...)
Does anybody know why?
Here's an example:
library(nlme)
library(MASS)
a <- d...
2003 Jul 30
0
stepAIC()
Hi,
I am experiencing a baffling behaviour of stepAIC(),
and I hope to get any advice/help on this. Greatly
appreciate any kind advice given.
I am using stepAIC() to, say, select a model via
stepwise selection method.
R Version : 1.7.1
Windows ME
Many thanks!
***Issue :
When stepAIC() is placed within a function, it seems
that stepAIC() cannot d...
2007 Jun 05
1
Question using stepAIC
Hi - I use stepAIC to automatically select the model. The stepAIC was applied on polr as follow:objPolr <- polr(formula=myformula, data=dat, method=METHOD);objPolr.step <- stepAIC(objPolr, trace=T);Then R complaints that it doesn't know about 'dat' when it executes the second line. Below is the exac...
2012 Nov 02
0
stepAIC and AIC question
I have a question about stepAIC and extractAIC and why they can
produce different answers.
Here's a stepAIC result (slightly edited - I removed the warning
about noninteger #successes):
stepAIC(glm(formula = (Morbid_70_79/Present_70_79) ~ 1 + Cohort +
Cohort2, family = binomial, data = ghs_70_79, subset =
ghs_70_full),d...
2017 Aug 23
3
boot.stepAIC fails with computed formula
...used a fixed formula, and rename it back afterwards.
Thanks for your help.
SGO.
-----Original Message-----
From: Bert Gunter [mailto:bgunter.4567 at gmail.com]
Sent: 22 August 2017 20:38
To: Stephen O'hagan <SOhagan at manchester.ac.uk>
Cc: r-help at r-project.org
Subject: Re: [R] boot.stepAIC fails with computed formula
OK, here's the problem. Continuing with your example:
strt1 <- lm(y1 ~1, dat)
strt2 <- lm(frm1,dat)
> strt1
Call:
lm(formula = y1 ~ 1, data = dat)
Coefficients:
(Intercept)
41.73
> strt2
Call:
lm(formula = frm1, data = dat)
Coefficients:
(I...
2006 May 05
1
trouble with step() and stepAIC() selecting the best model
Hello,
I have some trouble using step() and stepAIC() functions.
I'm predicting recruitment against several factors for different plant
species using a negative binomial glm.
Sometimes, summary(step(model)) or summary(stepAIC(model) does not
select the best model (lowest AIC) but just stops before.
For some species, step() works and stepAIC d...
2017 Aug 22
0
boot.stepAIC fails with computed formula
...ula into the lm object. This can be
done, e.g. via:
> strt2 <- eval(substitute(lm(form,data = dat), list(form = frm1)))
## yielding
> strt2
Call:
lm(formula = y1 ~ 1, data = dat)
Coefficients:
(Intercept)
41.73
So this looks like it should fix the problem, but alas no, the
boot.stepAIC call still fails with the same error message. Here's why:
> identical(strt$call, strt2$call)
[1] FALSE
So one might rightfully ask, what the heck is going on here?! Further digging:
> str(strt$call)
language lm(formula = y1 ~ 1, data = dat)
> str(strt2$call)
language lm(formula =...
2017 Aug 23
0
boot.stepAIC fails with computed formula
...ards.
>
> Thanks for your help.
> SGO.
>
> -----Original Message-----
> From: Bert Gunter [mailto:bgunter.4567 at gmail.com]
> Sent: 22 August 2017 20:38
> To: Stephen O'hagan <SOhagan at manchester.ac.uk>
> Cc: r-help at r-project.org
> Subject: Re: [R] boot.stepAIC fails with computed formula
>
> OK, here's the problem. Continuing with your example:
>
> strt1 <- lm(y1 ~1, dat)
> strt2 <- lm(frm1,dat)
>
>
>> strt1
>
> Call:
> lm(formula = y1 ~ 1, data = dat)
>
> Coefficients:
> (Intercept)
> 41.73...
2005 Aug 15
2
stepAIC invalid scope argument
I am trying to replicate the first example from stepAIC from the MASS
package with my own dataset but am running into error. If someone can
point where I have gone wrong, I would appreciate it very much.
Here is an example :
set.seed(1)
df <- data.frame( x1=rnorm(1000), x2=rnorm(1000), x3=rnorm(1000) )
df$y <- 0.5*df$x1 + rnorm(1000, mean=...
2017 Jun 06
1
glm and stepAIC selects too many effects
This is a question at the border between stats and r.
When I do a glm with many potential effects, and select a model using
stepAIC, many independent variables are selected even if there are no
relationship between dependent variable and the effects (all are random
numbers).
Do someone has a solution to prevent this effect ? Is it related to
Bonferoni correction ?
Is there is a ratio of independent vs number of observation...