[Analogue-commits] r381 - in pkg: R inst

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Wed Oct 9 04:42:45 CEST 2013


Author: gsimpson
Date: 2013-10-09 04:42:44 +0200 (Wed, 09 Oct 2013)
New Revision: 381

Modified:
   pkg/R/predict.pcr.R
   pkg/inst/ChangeLog
Log:
predict.pcr now applies the transformation

Modified: pkg/R/predict.pcr.R
===================================================================
--- pkg/R/predict.pcr.R	2013-10-08 05:21:32 UTC (rev 380)
+++ pkg/R/predict.pcr.R	2013-10-09 02:42:44 UTC (rev 381)
@@ -16,6 +16,8 @@
         want <- (spp.names <- colnames(object$data$x)) %in% colnames(newdata)
         want <- spp.names[want]
         newdata <- newdata[, want, drop = FALSE]
+        ## apply transformation to newdata
+        newdata <- obj$tranFun(newdata)
         ## do predictions
         ## matrix of predictions
         pred <- matrix(ncol = length(ncomp), nrow = Np)
@@ -23,8 +25,11 @@
             B0 <- object$yMean - object$xMeans %*% B[, j]
             pred[, j] <- newdata %*% B[, j] + rep(B0, Np)
         }
+    } else {
+        stop("Other methods of crossvalidation not yet implemented")
     }
     rownames(pred) <- newSamp
     colnames(pred) <- paste0("PC", ncomp)
     pred
 }
+

Modified: pkg/inst/ChangeLog
===================================================================
--- pkg/inst/ChangeLog	2013-10-08 05:21:32 UTC (rev 380)
+++ pkg/inst/ChangeLog	2013-10-09 02:42:44 UTC (rev 381)
@@ -20,6 +20,9 @@
 	are effectively 0. Only affects vectors of performance statistics
 	not data frames of stats.
 
+	* predict.pcr: Apply transformation function and stop is any form
+	of crossvalidation is selected (as not yet implemented).
+
 Version 0.11-5
 
 	* newDistance: (yet another) new distance() replacement to



More information about the Analogue-commits mailing list