[Mboost-commits] r747 - in pkg/mboostDevel: R man tests
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Tue Oct 8 16:23:03 CEST 2013
Author: hofner
Date: 2013-10-08 16:23:03 +0200 (Tue, 08 Oct 2013)
New Revision: 747
Modified:
pkg/mboostDevel/R/bl.R
pkg/mboostDevel/man/baselearners.Rd
pkg/mboostDevel/tests/regtest-baselearner.R
Log:
- brandom() now also has lambda as argument
Modified: pkg/mboostDevel/R/bl.R
===================================================================
--- pkg/mboostDevel/R/bl.R 2013-10-08 13:29:01 UTC (rev 746)
+++ pkg/mboostDevel/R/bl.R 2013-10-08 14:23:03 UTC (rev 747)
@@ -787,7 +787,7 @@
}
### random-effects (Ridge-penalized ANOVA) baselearner
-brandom <- function(..., by = NULL, index = NULL, df = 4,
+brandom <- function(..., by = NULL, index = NULL, df = 4, lambda = NULL,
contrasts.arg = "contr.dummy") {
cl <- cltmp <- match.call()
x <- list(...)
@@ -801,7 +801,7 @@
stop(sQuote("..."), " must be a factor or design matrix in ",
sQuote("brandom"))
- if (is.null(cl$df))
+ if (is.null(cl$df) && is.null(cl$lambda))
cl$df <- df
if (is.null(cl$contrasts.arg))
cl$contrasts.arg <- contrasts.arg
Modified: pkg/mboostDevel/man/baselearners.Rd
===================================================================
--- pkg/mboostDevel/man/baselearners.Rd 2013-10-08 13:29:01 UTC (rev 746)
+++ pkg/mboostDevel/man/baselearners.Rd 2013-10-08 14:23:03 UTC (rev 747)
@@ -38,7 +38,8 @@
args = list(Covariance="Matern", smoothness = 1.5, theta=NULL))
## random effects base-learner
-brandom(..., by = NULL, index = NULL, df = 4, contrasts.arg = "contr.dummy")
+brandom(..., by = NULL, index = NULL, df = 4, lambda = NULL,
+ contrasts.arg = "contr.dummy")
## tree based base-learner
btree(..., tree_controls = ctree_control(stump = TRUE,
Modified: pkg/mboostDevel/tests/regtest-baselearner.R
===================================================================
--- pkg/mboostDevel/tests/regtest-baselearner.R 2013-10-08 13:29:01 UTC (rev 746)
+++ pkg/mboostDevel/tests/regtest-baselearner.R 2013-10-08 14:23:03 UTC (rev 747)
@@ -471,3 +471,9 @@
extract(brandom(z1, z2))
## should throw an error
try(extract(brandom(x1, by = x2, intercept = FALSE)))
+
+## check if one can specify either df or lambda
+round(extract(brandom(z1, df = 3)$dpp(rep(1, 100)), what = "lambda"), 2)
+round(extract(brandom(z1, df = 3)$dpp(rep(1, 100)), what = "df"), 2)
+round(extract(brandom(z1, lambda = 50.39)$dpp(rep(1, 100)), what = "lambda"), 2)
+round(extract(brandom(z1, lambda = 50.39)$dpp(rep(1, 100)), what = "df"), 2)
More information about the Mboost-commits
mailing list