Re: [R] AIC function and Step function

2008-12-01 Thread Dana77
Thank you, Kingsford. Then I am wondering if there are other ways to write R codes to calculate the "weights" ? Thanks! Dana Kingsford Jones wrote: > > On Sun, Nov 30, 2008 at 5:05 PM, Dana77 <[EMAIL PROTECTED]> wrote: >> >> Thanks for kind help from Steven and Christos last time. Now I

Re: [R] AIC function and Step function

2008-11-30 Thread Kingsford Jones
On Sun, Nov 30, 2008 at 5:05 PM, Dana77 <[EMAIL PROTECTED]> wrote: > > Thanks for kind help from Steven and Christos last time. Now I got new > problem regarding the codes for calculating the "weights" (w) in "AIC () > function". > The original code is as below: > > getAnywhere("logLik.lm") > fu

Re: [R] AIC function and Step function

2008-11-30 Thread Dana77
Thanks for kind help from Steven and Christos last time. Now I got new problem regarding the codes for calculating the "weights" (w) in "AIC () function". The original code is as below: > getAnywhere("logLik.lm") function (object, REML = FALSE, ...) { res <- object$residuals p <- ob

Re: [R] AIC function and Step function

2008-11-27 Thread Steven McKinney
Hi Dana, Many thanks to Christos Hatzis who sent me an offline response, pointing out the new functions that make this much easier than my last suggestions: methods() and getAnywhere() > methods("extractAIC") [1] extractAIC.aov* extractAIC.coxph* extractAIC.glm* extractAIC.lm* ext

Re: [R] AIC function and Step function

2008-11-27 Thread Steven McKinney
df) } extractAIC.aov <- extractAIC.lm extractAIC.negbin <- function(fit, scale, k = 2, ...) { n <- length(fit$residuals) edf <- n - fit$df.residual c(edf, -fit$twologlik + k * edf) } HTH Steven McKinney Statistician Molecular Oncology and Breast Cancer Program British C

[R] AIC function and Step function

2008-11-27 Thread Dana77
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