From fbfffc0e47171cac03797340fde697a75a5afd61 Mon Sep 17 00:00:00 2001 From: Johannes Ranke Date: Mon, 26 Nov 2018 11:44:27 +0100 Subject: Add AIC method for mmkin column objects Static documentation rebuilt by pkgdown --- R/AIC.mmkin.R | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 R/AIC.mmkin.R (limited to 'R/AIC.mmkin.R') diff --git a/R/AIC.mmkin.R b/R/AIC.mmkin.R new file mode 100644 index 00000000..1d306ff9 --- /dev/null +++ b/R/AIC.mmkin.R @@ -0,0 +1,30 @@ +# Copyright (C) 2018 Johannes Ranke +# Contact: jranke@uni-bremen.de + +# This file is part of the R package mkin + +# mkin is free software: you can redistribute it and/or modify it under the +# terms of the GNU General Public License as published by the Free Software +# Foundation, either version 3 of the License, or (at your option) any later +# version. + +# This program is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more +# details. + +# You should have received a copy of the GNU General Public License along with +# this program. If not, see +AIC.mmkin <- function(object, ..., k = 2) { + # We can only handle a single column + if (ncol(object) != 1) stop("Please provide a single column object") + n.fits <- length(object) + model_names <- rownames(object) + + code <- paste0("AIC(", + paste0("object[[", 1:n.fits, "]]", collapse = ", "), + ", k = k)") + res <- eval(parse(text = code)) + if (n.fits > 1) rownames(res) <- model_names + return(res) +} -- cgit v1.2.1