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, ...) UseMethod("extractAIC") Could anyone point out to me where I can its source code? And my R version is: > version _ platform sparc-sun-solaris2.9 arch sparc os solaris2.9 system sparc, solaris2.9 status major 1 minor 9.0 year 2004 month 04 day 12 language R Thanks, -- Yu Shao Bioinformatics Group, Wadsworth Research Center New York State Department of Health
In R 2.0.1 under Windows 2000: > methods("extractAIC") [1] extractAIC.aov* extractAIC.coxph* extractAIC.glm* [4] extractAIC.lm* extractAIC.negbin* extractAIC.survreg* Non-visible functions are asterisked > getAnywhere("extractAIC.lm") A single object matching 'extractAIC.lm' was found It was found in the following places registered S3 method for extractAIC from namespace stats namespace:stats with value function (fit, scale = 0, k = 2, ...) { n <- length(fit$residuals) edf <- n - fit$df.residual RSS <- deviance.lm(fit) dev <- if (scale > 0) RSS/scale - n else n * log(RSS/n) c(edf, dev + k * edf) } <environment: namespace:stats> > hope this helps. spencer graves Yu Shao wrote:> 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, ...) UseMethod("extractAIC") > > > Could anyone point out to me where I can its source code? And my R > version is: > > > version > _ > platform sparc-sun-solaris2.9 > arch sparc > os solaris2.9 > system sparc, solaris2.9 > status > major 1 > minor 9.0 > year 2004 > month 04 > day 12 > language R > > > Thanks, >
Isn't this in the FAQ? Try:> methods("extractAIC")[1] extractAIC.aov* extractAIC.coxph* extractAIC.glm* extractAIC.lm* [5] extractAIC.negbin* extractAIC.survreg* Non-visible functions are asterisked Then use getAnywhere() or getS3method() to get the particular one you're interested in. Andy> From: Yu Shao > > 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, ...) UseMethod("extractAIC") > > > Could anyone point out to me where I can its source code? And my R > version is: > > > version > _ > platform sparc-sun-solaris2.9 > arch sparc > os solaris2.9 > system sparc, solaris2.9 > status > major 1 > minor 9.0 > year 2004 > month 04 > day 12 > language R > > > Thanks, > > -- > Yu Shao > Bioinformatics Group, Wadsworth Research Center > New York State Department of Health > > ______________________________________________ > R-help at stat.math.ethz.ch mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide! > http://www.R-project.org/posting-guide.html > >