On Oct 19, 2013, at 10:32 AM, David Winsemius wrote: > > On Oct 19, 2013, at 3:44 AM, Chris89 wrote: > >> Hi everyone! >> >> I am making some time series models, and as i want to compare a lot of >> models I thought it would be smart to compare the AIC, AICc and BIC values >> from the models. My question is, how can I extract the BIC and AICc from the >> model? >> >> As an example: >> >> kings <- scan("http://robjhyndman.com/tsdldata/misc/kings.dat",skip=3) >> mod = arima(kings, order = c(1,0,0), include.mean=T) >> >> obviously summary(mod) would suffice, > > How would that "obviously" suffice? There is no summary.Arima function, at > least that I see. (Maybe you have loaded an additonal package that you were > asked to tell us about?) > > >> but I don't want to have to look >> through all the models (as there are alot... ) > > The models already have an "aic" element: > >> modList <-list(mod,mod2); sapply(modList, "[", "aic") > $aic > [1] 352.8227 > > $aic > [1] 352.8227 > > (Please read the Fine Posting Guide.)
I evemtually did find an hidden and undocumented `summary.Arima` function in the 'forecast' package, but most (all?) of its output was via side-effects. It also appeared that it initially called another hidden function `print.Arima` also using side-effects rather than retruning an object. library(forecast) forecast:::print.Arima The code may be useful if you want to make a parred-down version that spits out AIC, BIC, AICc. > > -- > > David Winsemius > Alameda, CA, USA > > ______________________________________________ > R-help@r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. David Winsemius Alameda, CA, USA ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.