[Mboost-commits] r775 - in pkg: mboostDevel/R mboostDevel/vignettes mboostPatch mboostPatch/R mboostPatch/inst mboostPatch/man mboostPatch/vignettes
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Thu Jul 3 15:41:21 CEST 2014
Author: hofner
Date: 2014-07-03 15:41:21 +0200 (Thu, 03 Jul 2014)
New Revision: 775
Modified:
pkg/mboostDevel/R/mboost.R
pkg/mboostDevel/vignettes/mboost_tutorial.Rnw
pkg/mboostPatch/DESCRIPTION
pkg/mboostPatch/R/mboost.R
pkg/mboostPatch/inst/CHANGES
pkg/mboostPatch/man/mboost_package.Rd
pkg/mboostPatch/vignettes/mboost_tutorial.Rnw
Log:
- Update: changes in vignette mboost_tutorial to reflect recent changes in mboost
- Bugfix: model.frame for glmboost objects was broken
Modified: pkg/mboostDevel/R/mboost.R
===================================================================
--- pkg/mboostDevel/R/mboost.R 2014-06-27 17:06:32 UTC (rev 774)
+++ pkg/mboostDevel/R/mboost.R 2014-07-03 13:41:21 UTC (rev 775)
@@ -598,6 +598,12 @@
H
}
ret$rownames <- rownames(mf)
+ ### specialized method for model.frame
+ ret$model.frame <- function(which = NULL) {
+ if (!is.null(which))
+ warning("Argument ", sQuote("which"), " is ignored")
+ mf
+ }
class(ret) <- c("glmboost", "mboost")
return(ret)
}
@@ -660,6 +666,12 @@
H
}
ret$rownames <- rownames(X)
+ ### specialized method for model.frame
+ ret$model.frame <- function(which = NULL) {
+ if (!is.null(which))
+ warning("Argument ", sQuote("which"), " is ignored")
+ mf
+ }
class(ret) <- c("glmboost", "mboost")
return(ret)
}
Modified: pkg/mboostDevel/vignettes/mboost_tutorial.Rnw
===================================================================
--- pkg/mboostDevel/vignettes/mboost_tutorial.Rnw 2014-06-27 17:06:32 UTC (rev 774)
+++ pkg/mboostDevel/vignettes/mboost_tutorial.Rnw 2014-07-03 13:41:21 UTC (rev 775)
@@ -120,7 +120,7 @@
\begin{center}
\small
- \textbf{This is an extended and slightly modified version of the manuscript}\\
+ \textbf{This is an extended and (slightly) modified version of the manuscript}\\
Benjamin Hofner, Andreas Mayr, Nikolay Robinzonov and Mattthias Schmid (2014),
Model-based Boosting in \textsf{R} - A Hands-on Tutorial Using the \textsf{R}
Package mboost. \emph{Computational Statistics}, 29:3-35.\\
@@ -492,7 +492,8 @@
\noindent The aim of this case study is to compute accurate predictions for the
body fat of women based on available anthropometric measurements. Observations
of 71 German women are available with the data set \R{bodyfat} \citep{garcia}
-included in \textbf{mboost}. We first load the package and the data set.
+included in \textbf{mboost}. We first load the package and the data set%
+\footnote{The data set \R{bodyfat} has been moved to the package \pkg{TH.data}.}.
<<setup, echo = true, results = hide>>=
library("mboostDevel") ## load package
@@ -576,7 +577,7 @@
to combine different base-learners for plenty of predictors in \R{gamboost()}.
Note that at this iteration (\R{mstop} is still 100 as it is the default value)
-\R{anthro4a} is not included in the resulting model as the corresponding
+\R{anthro4} is not included in the resulting model as the corresponding
base-learner was never selected in the update step. The function \R{coef()} by
default only displays the selected variables but can be forced to show all
effects by specifying \R{which = ""}:
@@ -1214,7 +1215,7 @@
to determine the cross-validated risk is
\begin{Sinput}
cvrisk(object, folds = cv(model.weights(object)),
- papply = if (require("multicore")) mclapply else lapply)
+ papply = mclapply)
\end{Sinput}
In the simplest case, the user only needs to specify the fitted boosting model
as \R{object}. If one wants to change the default cross-validation method
@@ -1949,17 +1950,21 @@
<<cyclic1, width = 5,height = 5>>=
### example for cyclic spline
set.seed(1907)
-x <- runif(200, 0,(2*pi))
-y <- rnorm(200, mean=sin(x), sd=0.2)
-newX <- seq(0,2*pi, length=100)
-mod <- gamboost(y ~ bbs(x, knots = 12))
-mod_cyclic <- gamboost(y ~ bbs(x, cyclic = TRUE, knots = 12,
- boundary.knots = c(0, 2*pi)))
+true_f <- function(x)
+ cos(x) + 0.25 * sin(4 * x)
+x <- runif(150, 0, 2 * pi)
+y <- rnorm(150, mean = true_f(x), sd=0.1)
+newX <- seq(0, 2*pi, length = 200)
+mod <- gamboost(y ~ bbs(x, knots = 20, degree = 4))
+mod[3000]
+mod_cyclic <- gamboost(y ~ bbs(x, cyclic=TRUE, knots = 20,
+ degree = 4, boundary.knots=c(0, 2*pi)))
+mod_cyclic[3000]
par(mar = c(4, 4, 0, 0) + 0.1)
-plot(x,y,
- ylab = "f(x)",
- cex=1, pch = 20, col = rgb(0.5, 0.5, 0.5, alpha = 0.8))
+plot(x,y, ylab = "f(x)",
+ pch = 20, xlim = c(0, 7),
+ col = rgb(0.5, 0.5, 0.5, alpha = 0.8))
lines(newX, predict(mod, data.frame(x = newX)),
col = "black", lwd = 2)
lines(newX + 2 * pi, predict(mod, data.frame(x = newX)),
@@ -1970,8 +1975,9 @@
<<cyclic2, width = 5,height = 5>>=
par(mar = c(4, 4, 0, 0) + 0.1)
-plot(x,y, ylab = "f(x)",
- cex=1, pch = 20, col = rgb(0.5, 0.5, 0.5, alpha = 0.8))
+plot(x, y, ylab = "f(x)",
+ pch = 20, xlim = c(0, 7),
+ col = rgb(0.5, 0.5, 0.5, alpha = 0.8))
lines(newX, predict(mod_cyclic, data.frame(x = newX)),
col = red, lwd = 2)
lines(newX + 2 * pi, predict(mod_cyclic, data.frame(x = newX)),
Modified: pkg/mboostPatch/DESCRIPTION
===================================================================
--- pkg/mboostPatch/DESCRIPTION 2014-06-27 17:06:32 UTC (rev 774)
+++ pkg/mboostPatch/DESCRIPTION 2014-07-03 13:41:21 UTC (rev 775)
@@ -1,7 +1,7 @@
Package: mboost
Title: Model-Based Boosting
-Version: 2.3-0
-Date: 2014-06-26
+Version: 2.3-1
+Date: 2014-xx-yy
Authors at R: c(person("Torsten", "Hothorn", role = c("aut", "cre"),
email = "Torsten.Hothorn at R-project.org"),
person("Peter", "Buehlmann", role = "aut"),
Modified: pkg/mboostPatch/R/mboost.R
===================================================================
--- pkg/mboostPatch/R/mboost.R 2014-06-27 17:06:32 UTC (rev 774)
+++ pkg/mboostPatch/R/mboost.R 2014-07-03 13:41:21 UTC (rev 775)
@@ -598,6 +598,12 @@
H
}
ret$rownames <- rownames(mf)
+ ### specialized method for model.frame
+ ret$model.frame <- function(which = NULL) {
+ if (!is.null(which))
+ warning("Argument ", sQuote("which"), " is ignored")
+ mf
+ }
class(ret) <- c("glmboost", "mboost")
return(ret)
}
@@ -660,6 +666,12 @@
H
}
ret$rownames <- rownames(X)
+ ### specialized method for model.frame
+ ret$model.frame <- function(which = NULL) {
+ if (!is.null(which))
+ warning("Argument ", sQuote("which"), " is ignored")
+ mf
+ }
class(ret) <- c("glmboost", "mboost")
return(ret)
}
Modified: pkg/mboostPatch/inst/CHANGES
===================================================================
--- pkg/mboostPatch/inst/CHANGES 2014-06-27 17:06:32 UTC (rev 774)
+++ pkg/mboostPatch/inst/CHANGES 2014-07-03 13:41:21 UTC (rev 775)
@@ -1,5 +1,9 @@
CHANGES in `mboost' VERSION 2.3-1 (2014-xx-yy, rXYZ)
+ o changed vignette mboost_tutorial to reflect latest changes in mboost.
+
+ o Bugfix: model.frame() was broken for glmboost models
+
CHANGES in `mboost' VERSION 2.3-0 (2014-06-26, r771)
o stabsel was recoded and now uses different terminology, much more options
@@ -23,6 +27,8 @@
o boost_control: added new argument stopintern for internal stopping
(based on oobag data) during fitting
+ o All data sets have been moved to the new package set TH.data
+
o Misc:
- added new argmument which to variable.names()
- added new method risk to extract risks
Modified: pkg/mboostPatch/man/mboost_package.Rd
===================================================================
--- pkg/mboostPatch/man/mboost_package.Rd 2014-06-27 17:06:32 UTC (rev 774)
+++ pkg/mboostPatch/man/mboost_package.Rd 2014-07-03 13:41:21 UTC (rev 775)
@@ -15,8 +15,8 @@
\tabular{ll}{
Package: \tab mboost\cr
Type: \tab Package\cr
-Version: \tab 2.3-0\cr
-Date: \tab 2014-06-26\cr
+Version: \tab 2.3-1\cr
+Date: \tab 2014-xx-yy\cr
License: \tab GPL-2\cr
LazyLoad: \tab yes\cr
LazyData: \tab yes\cr
Modified: pkg/mboostPatch/vignettes/mboost_tutorial.Rnw
===================================================================
--- pkg/mboostPatch/vignettes/mboost_tutorial.Rnw 2014-06-27 17:06:32 UTC (rev 774)
+++ pkg/mboostPatch/vignettes/mboost_tutorial.Rnw 2014-07-03 13:41:21 UTC (rev 775)
@@ -120,7 +120,7 @@
\begin{center}
\small
- \textbf{This is an extended and slightly modified version of the manuscript}\\
+ \textbf{This is an extended and (slightly) modified version of the manuscript}\\
Benjamin Hofner, Andreas Mayr, Nikolay Robinzonov and Mattthias Schmid (2014),
Model-based Boosting in \textsf{R} - A Hands-on Tutorial Using the \textsf{R}
Package mboost. \emph{Computational Statistics}, 29:3-35.\\
@@ -492,7 +492,8 @@
\noindent The aim of this case study is to compute accurate predictions for the
body fat of women based on available anthropometric measurements. Observations
of 71 German women are available with the data set \R{bodyfat} \citep{garcia}
-included in \textbf{mboost}. We first load the package and the data set.
+included in \textbf{mboost}. We first load the package and the data set%
+\footnote{The data set \R{bodyfat} has been moved to the package \pkg{TH.data}.}.
<<setup, echo = true, results = hide>>=
library("mboost") ## load package
@@ -576,7 +577,7 @@
to combine different base-learners for plenty of predictors in \R{gamboost()}.
Note that at this iteration (\R{mstop} is still 100 as it is the default value)
-\R{anthro4a} is not included in the resulting model as the corresponding
+\R{anthro4} is not included in the resulting model as the corresponding
base-learner was never selected in the update step. The function \R{coef()} by
default only displays the selected variables but can be forced to show all
effects by specifying \R{which = ""}:
@@ -1214,7 +1215,7 @@
to determine the cross-validated risk is
\begin{Sinput}
cvrisk(object, folds = cv(model.weights(object)),
- papply = if (require("multicore")) mclapply else lapply)
+ papply = mclapply)
\end{Sinput}
In the simplest case, the user only needs to specify the fitted boosting model
as \R{object}. If one wants to change the default cross-validation method
@@ -1949,17 +1950,21 @@
<<cyclic1, width = 5,height = 5>>=
### example for cyclic spline
set.seed(1907)
-x <- runif(200, 0,(2*pi))
-y <- rnorm(200, mean=sin(x), sd=0.2)
-newX <- seq(0,2*pi, length=100)
-mod <- gamboost(y ~ bbs(x, knots = 12))
-mod_cyclic <- gamboost(y ~ bbs(x, cyclic = TRUE, knots = 12,
- boundary.knots = c(0, 2*pi)))
+true_f <- function(x)
+ cos(x) + 0.25 * sin(4 * x)
+x <- runif(150, 0, 2 * pi)
+y <- rnorm(150, mean = true_f(x), sd=0.1)
+newX <- seq(0, 2*pi, length = 200)
+mod <- gamboost(y ~ bbs(x, knots = 20, degree = 4))
+mod[3000]
+mod_cyclic <- gamboost(y ~ bbs(x, cyclic=TRUE, knots = 20,
+ degree = 4, boundary.knots=c(0, 2*pi)))
+mod_cyclic[3000]
par(mar = c(4, 4, 0, 0) + 0.1)
-plot(x,y,
- ylab = "f(x)",
- cex=1, pch = 20, col = rgb(0.5, 0.5, 0.5, alpha = 0.8))
+plot(x,y, ylab = "f(x)",
+ pch = 20, xlim = c(0, 7),
+ col = rgb(0.5, 0.5, 0.5, alpha = 0.8))
lines(newX, predict(mod, data.frame(x = newX)),
col = "black", lwd = 2)
lines(newX + 2 * pi, predict(mod, data.frame(x = newX)),
@@ -1970,8 +1975,9 @@
<<cyclic2, width = 5,height = 5>>=
par(mar = c(4, 4, 0, 0) + 0.1)
-plot(x,y, ylab = "f(x)",
- cex=1, pch = 20, col = rgb(0.5, 0.5, 0.5, alpha = 0.8))
+plot(x, y, ylab = "f(x)",
+ pch = 20, xlim = c(0, 7),
+ col = rgb(0.5, 0.5, 0.5, alpha = 0.8))
lines(newX, predict(mod_cyclic, data.frame(x = newX)),
col = red, lwd = 2)
lines(newX + 2 * pi, predict(mod_cyclic, data.frame(x = newX)),
More information about the Mboost-commits
mailing list