[Mboost-commits] r828 - in pkg/mboostPatch: man tests

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Thu Feb 12 14:58:04 CET 2015


Author: hofner
Date: 2015-02-12 14:58:04 +0100 (Thu, 12 Feb 2015)
New Revision: 828

Modified:
   pkg/mboostPatch/man/blackboost.Rd
   pkg/mboostPatch/tests/bugfixes.R
Log:
make manuals and bugfixes happy

Modified: pkg/mboostPatch/man/blackboost.Rd
===================================================================
--- pkg/mboostPatch/man/blackboost.Rd	2015-02-12 13:58:02 UTC (rev 827)
+++ pkg/mboostPatch/man/blackboost.Rd	2015-02-12 13:58:04 UTC (rev 828)
@@ -81,16 +81,17 @@
   \code{\link[mboost]{methods}}}
 \examples{
 
-    ### a simple two-dimensional example: cars data
-    cars.gb <- blackboost(dist ~ speed, data = cars,
-                          control = boost_control(mstop = 50))
-    cars.gb
+### a simple two-dimensional example: cars data
+cars.gb <- blackboost(dist ~ speed, data = cars,
+                      control = boost_control(mstop = 50))
+cars.gb
 
-    ### plot fit
-    plot(dist ~ speed, data = cars)
-    lines(cars$speed, predict(cars.gb), col = "red")
+### plot fit
+plot(dist ~ speed, data = cars)
+lines(cars$speed, predict(cars.gb), col = "red")
 
-    ### set up and plot additive tree model
+### set up and plot additive tree model
+if (require("party")) {
     ctrl <- ctree_control(maxdepth = 3)
     viris <- subset(iris, Species != "setosa")
     viris$Species <- viris$Species[, drop = TRUE]
@@ -101,6 +102,7 @@
                    data = viris, family = Binomial())[500]
     layout(matrix(1:4, ncol = 2))
     plot(imod)
+}
 
 }
 \keyword{models}

Modified: pkg/mboostPatch/tests/bugfixes.R
===================================================================
--- pkg/mboostPatch/tests/bugfixes.R	2015-02-12 13:58:02 UTC (rev 827)
+++ pkg/mboostPatch/tests/bugfixes.R	2015-02-12 13:58:04 UTC (rev 828)
@@ -215,15 +215,17 @@
     stopifnot(max(abs(predict(x[i]) - predict(x[max(s)], agg = "cumsum")[,i])) < eps)
 
 ### make sure environment(formula) is used for evaluation
-data("cars")
-ctl  <- boost_control(mstop = 100, trace = TRUE)
-tctl <- ctree_control(teststat = "max", testtype = "Teststat",
-                      mincrit = 0, maxdepth = 5, savesplitstat = FALSE)
-myfun <- function(cars, xx, zz){
-  mboost(dist ~ btree(speed, tree_controls = zz),
-         data = cars, control = xx)
+if (require("party")) {
+    data("cars")
+    ctl  <- boost_control(mstop = 100, trace = TRUE)
+    tctl <- ctree_control(teststat = "max", testtype = "Teststat",
+                          mincrit = 0, maxdepth = 5, savesplitstat = FALSE)
+    myfun <- function(cars, xx, zz){
+        mboost(dist ~ btree(speed, tree_controls = zz),
+               data = cars, control = xx)
+    }
+    try(mod <- myfun(cars, xx = ctl, zz = tctl))
 }
-try(mod <- myfun(cars, xx = ctl, zz = tctl))
 
 ### bbs with weights and expanded data
 x <- runif(100)



More information about the Mboost-commits mailing list