这是一个代码片段,可以帮助您入门:
library(tseries) #from tsdiag help page fit <- arima(lh, c(1,0,0)) #make an arbitrary list of model fits models <- list(m1 = fit, m2 = fit) lapply(1:length(models), function(x){ jpeg(paste0(names(models)[x], ".jpeg")) tsdiag(models[[x]]) dev.off() })