Displaying 20 results from an estimated 4000 matches similar to: "Source code for "extractAIC"?"
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 *
2004 May 24
1
bug in extractAIC.survreg (PR#6910)
Full_Name: Dave Ramsey
Version: 1.8.0
OS: win2000
Submission from: (NULL) (202.27.240.6)
there is a bug in extractAIC.survreg in library MASS.
A survreg model object has no component called "residuals". Hence
n <- length(fit$residuals)
returns 0 resulting in errors
workaround: replace
n <- length(fit$residuals)
with
n <- length(residuals(fit))
### sorry: error
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]
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
2004 Oct 28
2
Weighted regresion using lm
Hi:
Could anyone help me to clarify this: are the weights normalized inside lm
function (package:stats) before applied to the error term? For example:
>lm (cost ~ material, weights=quatity, data=receipt)
will lm normalize quatity such that sum(quatity) = 1? I traced to lm.wfit and
then the weights get transferred into a precompiled FORTRAN module so I can't
figure out. Thanks!
2004 Oct 04
1
Using model operator in stepwise function's upper scope formula
Hello:
I am doing forward stepwise analysis on the glm model. I am trying to use model
operator in the "upper" scope formula, for example,
scope=list(lower=~1,upper=~ .^2)
but the upper bound of the scope seems to be ignored and add1 is not performed
at all, while if the terms are explicitly listed in the formula, the step
function seems to work
2011 Feb 23
1
request for patch in "drop1" (add.R)
By changing three lines in drop1 from access based on $ to access
based on standard accessor methods (terms() and residuals()), it becomes
*much* easier to extend drop1 to work with other model types.
The use of $ rather than accessors in this context seems to be an
oversight rather than a design decision, but maybe someone knows better ...
In particular, if one makes these changes (which I am
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,
2006 Apr 21
1
Linker problem in installing 64-bit R
Hi,
I am trying to compile R-2.2.1 on Solaris 2.9 with a 64-bit build. Following
the instructions in "R Installation and Adminstration", I changed the
following settings in "config.site":
CC="gcc -m64"
F77="g77 -64"
CXX="g++ -m64"
LDFLAGS="-L/usr/local/lib/sparcv9 -L/usr/local/lib"
But I got the following error messages:
2011 May 10
0
Help documentation in extractAIC
Hello.
The sentence in extractAIC's help <http://www.stat.psu.edu/~dhunter/R/html/stats/html/extractAIC.html> which discusses AIC's estimate of -2logL from RSS reads: "AIC only handles unknown scale and uses the formula n log (RSS/n) - n + n log 2pi - sum(log w) where w are the weights. Further AIC counts the scale estimation as a parameter in the edf and extractAIC does
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.
2017 Nov 24
0
extractAIC.coxph warning
Hi,
It is not critical but in case of coxph.null model (~1)
extractAIC function generates
Warning message:
In is.na(fit$coefficients) :
is.na() applied to non-(list or vector) of type 'NULL'
As I understand it happens because of absent coefficients attribute.
Function stats:::extractAIC.coxph
Line edf <- sum(!is.na(fit$coefficients))
I think extra null-checking
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
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
2012 Feb 21
1
stepAIC error
i am trying to run stepwise regression for two models(lower,upper),
family=gamma
and i get the same error despite the models i use.
Error in UseMethod("extractAIC") :
no applicable method for 'extractAIC' applied to an object of class
"formula"
In addition: Warning message:
In nobs.default(object, use.fallback = TRUE) :
no 'nobs' method is available
Any
2011 May 21
2
unbalanced anova with subsampling (Type III SS)
Hello R-users,
I am trying to obtain Type III SS for an ANOVA with subsampling. My design
is slightly unbalanced with either 3 or 4 subsamples per replicate.
The basic aov model would be:
fit <- aov(y~x+Error(subsample))
But this gives Type I SS and not Type III.
But, using the drop() option:
drop1(fit, test="F")
I get an error message:
"Error in
2011 Aug 04
0
extractAIC
Use extractAIC in frailty cox model (estimated with coxph function, gaussian
random effect) i obtaided
> extractAIC(fit.cox.f)
[1] 11.84563 8649.11736
but I don't know why I can't use the classic formulation of the AIC where
the degree of freedom are the number of the parameter (in my case 3).
--
View this message in context:
2009 Sep 22
0
AIC vs. extractAIC
Dear list,
I am confused about two functions in R: AIC(fm) and extractAIC(fm). What is
the difference between two and when do I have to use one over the other? I
have found the similar question previously and still not clear for me to
understand. I also looked at '?AIC' and '?extractAIC' in R, which is also
unclear. I pasted faked data set, fitting summary, and AICs.
Thank
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
2002 May 28
1
constrained regression
I want to do a linear regression where the coefficients
obey two linear constraints, and also are all non-negative.
What is the best way to do this? Computational speed is a
consideration as I must do it many times.
When this question was asked previously on the list, quadprog
was suggested - is this the best solution?
(I may have missed something obvious in the documentation,
but I have