Displaying 20 results from an estimated 2000 matches similar to: "stepAIC error"
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.
It works as
2009 May 05
0
stepAICc function (based on MASS:::stepAIC.default)
Dear all,
I have tried to modify the code of MASS:::stepAIC.default(), dropterm() and addterm() to use AICc instead of AIC for model selection.
The code is appended below. Somehow the calculations are still not correct and I would be grateful if anyone could have a look at what might be wrong
with this code...
Here is a working example:
##
require(nlme)
model1=lme(distance ~ age + Sex, data =
2012 Mar 02
3
Why predicted values are fewer that the real?
Hi
i am running a glm model family Gamma(link=log) trying to predict a vector
of 1554 (real) values
Using predict() i got a vector of 950 predicted values instead of 1554.
The predictions are good though
The model doesnt take account of negative values and NAs which are only 121
values.
Any clue?
Thank
--
View this message in context:
2009 Jan 26
1
glm StepAIC with all interactions and update to remove a term vs. glm specifying all but a few terms and stepAIC
Problem:
I am sorting through model selection process for first time and want to make
sure that I have used glm, stepAIC, and update correctly. Something is
strange because I get a different result between:
1) a glm of 12 predictor variables followed by a stepAIC where all
interactions are considered and then an update to remove one specific
interaction.
vs.
2) entering all the terms
2012 Sep 29
1
Problems with stepAIC
Dear help community,
I'm a R-beginner and use it for my master thesis.
I've got a mixed model and want to analyse it with lme. There are a lot
Cofactors that coult be relevant. To extract the important ones I want to do
the stepAIC, but always get an error warning.
Structure of my data:
data.frame': 72 obs. of 54 variables:
$ Block : Factor w/ 3 levels
2013 May 01
1
Trouble with methods() after loading gdata package.
Greetings to r-help land.
I've run into some program crashes and I've traced them back to methods()
behavior
after the package gdata is loaded. I provide now a minimal re-producible
example. This seems bugish to me. How about you?
dat <- data.frame(x = rnorm(100), y = rnorm(100))
lm1 <- lm(y ~ x, data = dat)
methods(class = "lm")
## OK so far
library(gdata)
2008 Oct 22
1
forward stepwise regression using Mallows Cp
So I recognize that:
1. many people hate forward stepwise regression (i've read the archives)--but I need it
2. step() or stepAIC are two ways to get a stepwise regression in R
But here's the thing: I can't seem to figure out how to specify that I want the criteria to be Mallow's Cp (and then to subsequently tell me what the Cp stat is). I know it has something to do with
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),direction = c("backward"))
Start: AIC=3151.41
2004 Mar 05
1
Application of step to coxph using method="exact" (PR#6646)
Full_Name: John E. Kolassa
Version: Version 1.8.1
OS: Solaris
Submission from: (NULL) (128.6.76.36)
Stepwise model selection for coxph appears to fail with method="exact".
The code
step(coxph(Surv(1:100,rep(1,100))~factor(rep(1:4,25)),method="exact"))
produces the error message
Start: AIC= 733.07
Surv(1:100, rep(1, 100)) ~ factor(rep(1:4, 25))
Error in
2005 Jan 26
2
Source code for "extractAIC"?
Dear R users:
I am looking for the source code for the R function extractAIC. Type the
function name doesn't help:
> extractAIC
function (fit, scale, k = 2, ...)
UseMethod("extractAIC")
<environment: namespace:stats>
And when I search it in the R source code, the best I can find is in (R
source root)/library/stats/R/add.R:
extractAIC <- function(fit, scale, k = 2,
2006 Aug 06
1
extractAIC using surf.ls
Although the 'spatial' documentation doesn't mention that extractAIC
works, it does seem to give an output.
I may have misunderstood, but shouldn't the following give at least
the same d.f.?
> library(spatial)
> data(topo, package="MASS")
> extractAIC(surf.ls(2, topo))
[1] 46.0000 437.5059
> extractAIC(lm(z ~ x+I(x^2)+y+I(y^2)+x:y, topo))
[1]
2009 Apr 30
1
stepAICc
Dear R users,
Would it be difficult to change the code of stepAIC (from the MASS
library) to use AICc instead of AIC?
It would be great to know of someone has tried this already.
Best wishes
Christoph.
2002 Apr 01
0
something confusing about stepAIC
Folks, I'm using stepAIC(MASS) to do some automated, exploratory, model
selection for binomial and Poisson glm models in R 1.3. Because I wanted to
experiment with the small-sample correction AICc, I dug around in the code
for the functions
glm.fit
stepAIC
dropterm.glm
addterm.glm
extractAIC.glm
and came across something I just don't understand.
stepAIC() passes dropterm.glm() a
2011 Jun 20
1
Stepwise model comparisons for mlogit
I am trying to perform a backwards stepwise variable selection with an mlogit model. The usual functions, step(), drop1(), and dropterm() do not work for mlogit models.
Update() works but I am only able to use it manually, i.e. I have to type in each variable I wish to remove by hand on a separate line.
My goal is to write some code that will systematically remove a certain set of variables
2010 Dec 26
1
Calculation of BIC done by leaps-package
Hi Folks,
I've got a question concerning the calculation of the Schwarz-Criterion
(BIC) done by summary.regsubsets() of the leaps-package:
Using regsubsets() to perform subset-selection I receive an regsubsets
object that can be summarized by summary.regsubsets(). After this
operation the resulting summary contains a vector of BIC-values
representing models of size i=1,...,K.
My problem
2007 Dec 07
1
AIC v. extractAIC
Hello,
I am using a simple linear model and I would like to get an AIC value. I
came across both AIC() and extractAIC() and I am not sure which is best to
use. I assumed that I should use AIC for a glm and extractAIC() for lm,
but if I run my model in glm the AIC value is the same if I use AIC() on an
lm object. What might be going on? Did I interpret these functions
incorrectly?
Thanks,
2017 Aug 23
0
MASS:::dropterm.glm() and MASS:::addterm.glm() should use ... for extractAIC()
Hi,
I have sent this message to this list the July, 7th. It was about a
problem in MASS package.
Until now there is no change in the devel version.
As the problem occurs in a package and not in the R-core, I don't know
if the message should have been sent here. Anyway, I have added a copy
to Pr Ripley.
I hope it could have been fixed.
Sincerely
Marc
Le 09/07/2017 ? 16:05, Marc Girondot via
2008 Nov 28
2
AIC function and Step function
I would like to figure out the equations for calculating "AIC" in both
"step() function" and "AIC () function". They are different. Then I
just type "step" in the R console, and found the "AIC" used in "step()
function" is "extractAIC". I went to the R help, and found:
"The criterion used is
AIC = - 2*log L + k *
2012 Jan 20
1
nobs() and logLik()
Dear all,
I am studying a bit the various support functions that exist for
extracting information from fitted model objects.
From the help files it is not completely clear to me whether the number
returned by nobs() should be the same as the "nobs" attribute of the
object returned by logLik().
If so, then there is a slight inconsistency in the methods for 'nls'
objects with
2012 Apr 24
1
nobs.glm
Hi all,
The nobs method of (MASS:::polr class) takes into account of weight,
but nobs method of glm does not. I wonder what is the rationale of
such design behind nobs.glm. Thanks in advance. Best Regards.
> library(MASS)
> house.plr <- polr(Sat ~ Infl + Type + Cont, weights = Freq, data = housing)
> house.logit <- glm(I(Sat=='High') ~ Infl + Type + Cont, binomial,weights