[Analogue-commits] r206 - in pkg: R inst
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Sat Jan 29 00:24:42 CET 2011
Author: gsimpson
Date: 2011-01-29 00:24:42 +0100 (Sat, 29 Jan 2011)
New Revision: 206
Modified:
pkg/R/fixUpTol.R
pkg/R/predict.wa.R
pkg/inst/ChangeLog
Log:
fix bugs in bootstrap and k-fold CV, plus silly stop criterion in fixUpTol
Modified: pkg/R/fixUpTol.R
===================================================================
--- pkg/R/fixUpTol.R 2011-01-28 23:18:11 UTC (rev 205)
+++ pkg/R/fixUpTol.R 2011-01-28 23:24:42 UTC (rev 206)
@@ -10,9 +10,12 @@
}
## second, replace tol < min.tol
if(!is.null(min.tol) && any(MIN.TOL <- tol < min.tol)) {
- ## min.tol must be in or on extremesof range(env)
- if(min.tol < min(env) || min.tol > max(env))
- stop("'min.tol' must be >= min(env) and <= max(env)")
+ ## min.tol must be in or on extremes of range(tol)
+ ## originally had min(env) and max(env), but that doesn't make sense
+ ## I think the point was to stop user supplying too low tolerances
+ ## but this has nothing to do with the range of the environment
+ if(min.tol < min(tol) || min.tol > max(tol))
+ stop("'min.tol' must be >= min(tol) and <= max(tol)")
if(small.tol == "fraction")
frac <- f * diff(range(env))
tol[MIN.TOL] <-
Modified: pkg/R/predict.wa.R
===================================================================
--- pkg/R/predict.wa.R 2011-01-28 23:18:11 UTC (rev 205)
+++ pkg/R/predict.wa.R 2011-01-28 23:24:42 UTC (rev 206)
@@ -104,11 +104,11 @@
wa.optima <- w.avg(X[sel,,drop = FALSE], ENV[sel])
## CV for the training set
if(object$tol.dw) {
- tol <- w.tol(X[sel, , drop = FALSE], ENV[-sel],
+ tol <- w.tol(X[sel, , drop = FALSE], ENV[sel],
wa.optima, useN2 = useN2)
## fix up problematic tolerances
tol <- fixUpTol(tol, O$na.tol, O$small.tol,
- O$min.tol, O$f, ENV[-sel])
+ O$min.tol, O$f, ENV[sel])
wa.env <- WATpred(X[sel, , drop = FALSE],
wa.optima, tol, nr, nc)
pred <- WATpred(X[-sel, ,drop=FALSE], wa.optima,
@@ -155,11 +155,11 @@
wa.optima <- w.avg(X[sel,], ENV[sel])
## CV for the training set
if(object$tol.dw) {
- tol <- w.tol(X[sel, , drop = FALSE], ENV[-sel],
+ tol <- w.tol(X[sel, , drop = FALSE], ENV[sel],
wa.optima, useN2 = useN2)
## fix up problematic tolerances
tol <- fixUpTol(tol, O$na.tol, O$small.tol,
- O$min.tol, O$f, ENV[-sel])
+ O$min.tol, O$f, ENV[sel])
wa.env <- WATpred(X[sel, , drop = FALSE],
wa.optima, tol, nr, nc)
pred <- WATpred(X[-sel, ,drop=FALSE], wa.optima,
Modified: pkg/inst/ChangeLog
===================================================================
--- pkg/inst/ChangeLog 2011-01-28 23:18:11 UTC (rev 205)
+++ pkg/inst/ChangeLog 2011-01-28 23:24:42 UTC (rev 206)
@@ -49,6 +49,12 @@
the package tarball size considerably. As a result, however,
analogue now requires R version 2.10.0 or later.
+ * predict.wa: bug in bootstrap and k-fold CV methods when
+ tolerance down-weighting was used.
+
+ * fixUpTol: erroneous error criterion would cause CV of WA models
+ with tolerance down-weighting to stop with an error.
+
Version 0.6-26
* abernethy: New data set containing the classic Abernethy Forest
More information about the Analogue-commits
mailing list