[Analogue-commits] r118 - in pkg: R inst man

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Sun Apr 26 12:56:06 CEST 2009


Author: gsimpson
Date: 2009-04-26 12:56:06 +0200 (Sun, 26 Apr 2009)
New Revision: 118

Modified:
   pkg/R/predict.mat.R
   pkg/inst/ChangeLog
   pkg/man/predict.mat.Rd
Log:
predict.mat returns the dissimilarity betwen training set samples and 'newdata' samples;
Updated the help page for predict.mat to document new feature, plus some features previously undocumented in returned object;

Modified: pkg/R/predict.mat.R
===================================================================
--- pkg/R/predict.mat.R	2009-04-26 09:17:26 UTC (rev 117)
+++ pkg/R/predict.mat.R	2009-04-26 10:56:06 UTC (rev 118)
@@ -43,14 +43,14 @@
           else
             k <- which.min(object$standard$rmsep)
         }
-      dis <- distance(x = object$orig.x, y = newdata,
+      Dij <- distance(x = object$orig.x, y = newdata,
                       method = object$method)
-      minDC <- apply(dis, 2, function(x) {sort(x)[1]})
+      minDC <- apply(Dij, 2, function(x) {sort(x)[1]})
       quantiles <- quantile(as.dist(object$Dij), probs = probs)
       if(weighted)
-        predicted <- apply(dis, 2, cumWmean, object$orig.y, drop = FALSE)
+        predicted <- apply(Dij, 2, cumWmean, object$orig.y, drop = FALSE)
       else
-        predicted <- apply(dis, 2, cummean, object$orig.y, drop = FALSE)
+        predicted <- apply(Dij, 2, cummean, object$orig.y, drop = FALSE)
       est <- fitted(object, weighted = weighted)$estimated
       obs <- object$orig.y
       resi <- resid(object, k = k, weighted = weighted)
@@ -75,7 +75,8 @@
                   predictions = list(model =
                     list(predicted = predicted,
                          k = k)),
-                  minDC = minDC)
+                  minDC = minDC,
+                  Dij = Dij)
     } else {
       if(missing(k))
         k <- NULL

Modified: pkg/inst/ChangeLog
===================================================================
--- pkg/inst/ChangeLog	2009-04-26 09:17:26 UTC (rev 117)
+++ pkg/inst/ChangeLog	2009-04-26 10:56:06 UTC (rev 118)
@@ -17,6 +17,9 @@
 	'densityplot' and 'histogram' methods for 'residLen' objects using
 	Lattice graphics.
 
+	* predict.mat: Now returns the dissimilarity matrix between the 
+	training set samples and samples in 'newdata'.
+
 Version 0.6-7 (Closed Mon 13 Apr 2009) 
 
 	* optima, tolerance: new methods to coerce objects of these classes

Modified: pkg/man/predict.mat.Rd
===================================================================
--- pkg/man/predict.mat.Rd	2009-04-26 09:17:26 UTC (rev 117)
+++ pkg/man/predict.mat.Rd	2009-04-26 10:56:06 UTC (rev 118)
@@ -124,6 +124,14 @@
 	the same components as \code{sample.errors}, above.}
     }
   }
+  \item{method}{the dissimilarity measure used to fit the underlying MAT
+    models.}
+  \item{quantiles}{probability quantiles of the pairwise dissimilarities
+    computed from the training set.}
+  \item{minDC}{smallest distances between each sample in \code{newdata}
+    and the training set samples.}
+  \item{Dij}{dissimilarities between \code{newdata} and training set
+    samples.}
 }
 
 \references{



More information about the Analogue-commits mailing list