
> options(prompt = "R> ", continue = "+  ", digits = 4)

> set.seed(290875)

> options(mboost_dftraceS = TRUE)

> cvm <- structure(c(3.74633735312306, 5.02946541353383, 
+     3.80586309523809, 4.09154401154402, 5.18187411378943, 5.60488505747126, 
+     5.26579 .... [TRUNCATED] 

> if (!require("mboost")) install.packages("mboost", 
+     dependencies = TRUE)
Loading required package: mboost
Loading required package: parallel
Loading required package: stabs

> library("mboost")

> if (!require("partykit")) install.packages("partykit", 
+     dependencies = TRUE)
Loading required package: partykit
Loading required package: grid
Loading required package: libcoin
Loading required package: mvtnorm

Attaching package: ‘partykit’

The following object is masked from ‘package:mboost’:

    varimp


> library("partykit")

> data("bodyfat", package = "TH.data")

> features <- names(bodyfat)[-2]

> fml <- paste("bols(", features, ")", collapse = " + ")

> fms <- paste("bbs(", features, ", center = TRUE, df = 1)", 
+     collapse = " + ")

> fmt <- "btree(hipcirc, waistcirc, tree_controls = ctree_control(maxdepth = 2, mincriterion = 0))"

> fm <- as.formula(paste("DEXfat", paste(fml, fms, fmt, 
+     sep = "+"), sep = "~"))

> library("mboost")

> print(fm)
DEXfat ~ bols(age) + bols(waistcirc) + bols(hipcirc) + bols(elbowbreadth) + 
    bols(kneebreadth) + bols(anthro3a) + bols(anthro3b) + bols(anthro3c) + 
    bols(anthro4) + bbs(age, center = TRUE, df = 1) + bbs(waistcirc, 
    center = TRUE, df = 1) + bbs(hipcirc, center = TRUE, df = 1) + 
    bbs(elbowbreadth, center = TRUE, df = 1) + bbs(kneebreadth, 
    center = TRUE, df = 1) + bbs(anthro3a, center = TRUE, df = 1) + 
    bbs(anthro3b, center = TRUE, df = 1) + bbs(anthro3c, center = TRUE, 
    df = 1) + bbs(anthro4, center = TRUE, df = 1) + btree(hipcirc, 
    waistcirc, tree_controls = ctree_control(maxdepth = 2, mincriterion = 0))

> model <- mboost(fm, data = bodyfat, family = QuantReg(tau = 0.5))

> model[1000]

	 Model-based Boosting

Call:
mboost(formula = fm, data = bodyfat, family = QuantReg(tau = 0.5))


	 Quantile Regression 

Loss function: tau * (y - f) * ((y - f) >= 0) - (1 - tau) * (y - f) * ((y -  
     f) < 0) 
 

Number of boosting iterations: mstop = 1000 
Step size:  0.1 
Offset:  29.63 
Number of baselearners:  19 


> model[mstop(cvm)]

	 Model-based Boosting

Call:
mboost(formula = fm, data = bodyfat, family = QuantReg(tau = 0.5))


	 Quantile Regression 

Loss function: tau * (y - f) * ((y - f) >= 0) - (1 - tau) * (y - f) * ((y -  
     f) < 0) 
 

Number of boosting iterations: mstop = 770 
Step size:  0.1 
Offset:  29.63 
Number of baselearners:  19 


> cex <- 1.3

> layout(matrix(c(1, 2, 1, 3), nr = 2))

> par(mai = par("mai") * c(0.8, 1.1, 0.8, 0.8))

> plot(cvm, cex.lab = cex)

> mtext(text = "(A)", side = 3, 1, adj = 1)

> plot(model, which = "bols(anthro3b", cex.lab = cex)

> mtext(text = "(B)", side = 3, 1, adj = 1)

> plot(model, which = "bbs(anthro3b", ylim = range(predict(model, 
+     which = "bols(anthro3b")), cex.lab = cex)

> mtext(text = "(C)", side = 3, 1, adj = 1)

> nd <- with(bodyfat, expand.grid(hipcirc = h <- seq(from = min(hipcirc), 
+     to = max(hipcirc), length = 100), waistcirc = w <- seq(from = min(wai .... [TRUNCATED] 

> col <- c("#023FA5", "#1141A4", "#1A44A4", "#2146A4", 
+     "#2749A4", "#2C4BA4", "#304DA4", "#3550A5", "#3852A5", "#3C54A6", 
+     "#4056A6", "#43 ..." ... [TRUNCATED] 

> print(plot(model, which = "btree", newdata = nd, col.regions = col, 
+     at = seq(from = -16, to = 16, length = 100)))

> nd <- with(bodyfat, data.frame(anthro3b = seq(min(anthro3b), 
+     max(anthro3b), length = 100)))

> pr <- predict(model, which = "anthro3b", newdata = nd)

> pr <- rowSums(pr)

> plot(nd$anthro3b, pr, type = "l", xlab = "anthro3b", 
+     ylab = "f(anthro3b)")

> lines(nd$anthro3b, predict(model, which = "bols(anthro3b", 
+     newdata = nd), type = "l", lty = "dashed")

> thisdir <- getwd()

> bibfile <- system.file("REFERENCES.bib", package = "mboost")

> if (file.copy(bibfile, to = thisdir, overwrite = TRUE)) {
+     bibfile <- "REFERENCES.bib"
+ } else {
+     bibfile <- file.path("..", "inst", "REF ..." ... [TRUNCATED] 

> library("bibtex")

> library("bibtex")

> mboost <- citation(package = "mboost", auto = TRUE)

> x <- unclass(mboost)

> attr(x[[1]], "key") <- "mboost"

> class(x) <- class(mboost)

> x$doi <- "10.32614/CRAN.package.mboost"

> writeLines(toBibtex(x), con = "packages.bib")

> write.bib(c("Matrix"), file = "packages.bib", append = TRUE)
Converted 1 of 1 package citations to BibTeX
Writing 1 Bibtex entries ... OK
Results written to file 'packages.bib'

 *** Run successfully completed ***
> proc.time()
   user  system elapsed 
  3.291   0.078   3.378 
