[Mattice-commits] r124 - pkg/R

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Tue Dec 30 16:08:11 CET 2008


Author: andrew_hipp
Date: 2008-12-30 16:08:10 +0100 (Tue, 30 Dec 2008)
New Revision: 124

Modified:
   pkg/R/informationCriterion.R
Log:
removing lengthy comment; changing "if (n==1)" to "if(identical(n,1))"

Modified: pkg/R/informationCriterion.R
===================================================================
--- pkg/R/informationCriterion.R	2008-12-30 07:15:43 UTC (rev 123)
+++ pkg/R/informationCriterion.R	2008-12-30 15:08:10 UTC (rev 124)
@@ -1,6 +1,5 @@
 informationCriterion <- function(u = NULL, lnL = NULL, K, n = 1, names = NULL) {
-## Returns information criterion values + weights for a vector of u or lnL, a vector of K (= df), and a single n (sample size); names for analyses are optional
-  if(n == 1) warning("Information criterion values calculated assuming sample size = 1; if this is accurate, consider additional sampling for future projects.")
+  if(identical(n, 1)) warning("Information criterion values calculated assuming sample size = 1; if this is accurate, consider additional sampling for future projects.")
   if(identical(u,NULL)) u <- -2 * lnL # deviance (u) needed; take from lnL if not provided, ignore lnL if provided
   if(identical(names, NULL)) names <- seq(length(u))
   AIC <- vector("numeric", length(u))
@@ -33,7 +32,7 @@
   return(outdata)
 }
 
-print.informationCriterion <- function(ic) {
+print.informationCriterion <- function(ic, ...) {
   items <- c('u', 'K', 'AIC', 'AICc', 'BIC', 'AICwi', 'AICcwi', 'BICwi')
   out <- matrix(NA, nrow = length(ic$names), ncol = length(items), dimnames = list(ic$names, items))
   for(i in items) out[, i] <- ic[[i]]



More information about the Mattice-commits mailing list