R Under development (unstable) (2026-01-25 r89330 ucrt) -- "Unsuffered Consequences" Copyright (C) 2026 The R Foundation for Statistical Computing Platform: x86_64-w64-mingw32/x64 R is free software and comes with ABSOLUTELY NO WARRANTY. You are welcome to redistribute it under certain conditions. Type 'license()' or 'licence()' for distribution details. R is a collaborative project with many contributors. Type 'contributors()' for more information and 'citation()' on how to cite R or R packages in publications. Type 'demo()' for some demos, 'help()' for on-line help, or 'help.start()' for an HTML browser interface to help. Type 'q()' to quit R. > ### > # check gamboostLSS() > > require("gamboostLSS") Loading required package: gamboostLSS Loading required package: gamlss.dist Loading required package: mboost Loading required package: parallel Loading required package: stabs Attaching package: 'mboost' The following object is masked from 'package:gamlss.dist': Family Attaching package: 'gamboostLSS' The following object is masked from 'package:stats': model.weights > > set.seed(1907) > x1 <- rnorm(1000) > x2 <- rnorm(1000) > x3 <- rnorm(1000) > x4 <- rnorm(1000) > x5 <- rnorm(1000) > x6 <- rnorm(1000) > mu <- exp(1.5 + 0.3 * x1^2 + 0.5 * x2 - 3 * sin(x3) -1 * x4) > sigma <- exp(-0.2 * x4 + 0.2 * x5 + 0.4 * x6) > y <- numeric(1000) > for( i in 1:1000) + y[i] <- rnbinom(1, size = sigma[i], mu = mu[i]) > dat <- data.frame(x1, x2, x3, x4, x5, x6, y) > > model <- gamboostLSS(y ~ ., families = NBinomialLSS(), data = dat, + control = boost_control(mstop = 200)) > > coef(model) $mu $mu$`bbs(x1, df = dfbase)` 1 2 3 4 5 6 1.15444395 0.93545397 0.71693704 0.50042430 0.28570772 0.07534543 7 8 9 10 11 12 -0.11839907 -0.27732535 -0.38543945 -0.43568222 -0.42822231 -0.36389778 13 14 15 16 17 18 -0.24633715 -0.08712614 0.09162069 0.27043067 0.45036701 0.63285564 19 20 21 22 23 24 0.81691756 1.00419550 1.19460233 1.38640563 1.57832865 1.77025959 $mu$`bbs(x2, df = dfbase)` 1 2 3 4 5 -0.3672900254 -0.3558804586 -0.3444700445 -0.3330501859 -0.3215346586 6 7 8 9 10 -0.3097128858 -0.2972908332 -0.2840287980 -0.2698404028 -0.2552168243 11 12 13 14 15 -0.2393630113 -0.2180543325 -0.1868538242 -0.1421989625 -0.0805408195 16 17 18 19 20 -0.0007499722 0.0957227226 0.2045754541 0.3171470308 0.4253103206 21 22 23 24 0.5293373507 0.6314883014 0.7326624153 0.8337638009 $mu$`bbs(x3, df = dfbase)` 1 2 3 4 5 6 1.62690752 1.66179015 1.69621916 1.72718129 1.74723416 1.73977904 7 8 9 10 11 12 1.66796113 1.47592050 1.11762042 0.61818391 0.03382329 -0.54796311 13 14 15 16 17 18 -1.03626818 -1.38264045 -1.58369400 -1.66929673 -1.67606560 -1.63348348 19 20 21 22 23 24 -1.56155293 -1.47222603 -1.37332082 -1.26954035 -1.16391411 -1.05812521 $mu$`bbs(x4, df = dfbase)` 1 2 3 4 5 6 2.55229363 2.24960553 1.94876411 1.65787563 1.38476696 1.13402108 7 8 9 10 11 12 0.90460104 0.69199958 0.48667666 0.27458711 0.04879986 -0.17271442 13 14 15 16 17 18 -0.36207876 -0.50902480 -0.61846342 -0.69684702 -0.75045489 -0.78790732 19 20 21 22 23 24 -0.81606432 -0.83940053 -0.86068781 -0.88116968 -0.90145775 -0.92172844 attr(,"offset") [1] 4.055461 $sigma $sigma$`bbs(x1, df = dfbase)` 1 2 3 4 5 6 -0.030414466 -0.022125592 -0.013853689 -0.005537593 0.003564301 0.013555210 7 8 9 10 11 12 0.022918021 0.029180393 0.030332234 0.026724518 0.021145905 0.015189256 13 14 15 16 17 18 0.010297452 0.008747265 0.011992084 0.020480822 0.032398967 0.046426118 19 20 21 22 23 24 0.061714568 0.077812311 0.094364516 0.111135207 0.128012849 0.144908348 $sigma$`bbs(x2, df = dfbase)` 1 2 3 4 5 6 -1.00531251 -0.89894192 -0.79242149 -0.68500253 -0.57580587 -0.46457096 7 8 9 10 11 12 -0.35361687 -0.24906415 -0.15890635 -0.08197539 -0.01224824 0.05171766 13 14 15 16 17 18 0.11197234 0.16734046 0.20896076 0.23023382 0.22855164 0.21542983 19 20 21 22 23 24 0.20447998 0.20878257 0.22816321 0.25642982 0.28851622 0.32095751 $sigma$`bbs(x3, df = dfbase)` 1 2 3 4 5 6 0.12063540 0.25402927 0.38682572 0.51548480 0.63424539 0.73889097 7 8 9 10 11 12 0.82637001 0.89629039 0.94519456 0.94149973 0.85858322 0.66899777 13 14 15 16 17 18 0.37527216 0.03122394 -0.30529938 -0.58985492 -0.78942381 -0.90269096 19 20 21 22 23 24 -0.94431872 -0.93456023 -0.89272664 -0.83376343 -0.76851225 -0.70247345 $sigma$`bbs(x4, df = dfbase)` 1 2 3 4 5 6 0.86989263 0.87994191 0.88853847 0.88929980 0.87589782 0.84275363 7 8 9 10 11 12 0.78591633 0.70378776 0.60586559 0.50846766 0.41948694 0.32797964 13 14 15 16 17 18 0.21454814 0.07793247 -0.07497320 -0.23830307 -0.39954949 -0.55170872 19 20 21 22 23 24 -0.69771926 -0.84192690 -0.98877500 -1.13761935 -1.28717664 -1.43691338 $sigma$`bbs(x5, df = dfbase)` 1 2 3 4 5 -0.0023004784 -0.0022666543 -0.0022291318 -0.0021710971 -0.0020661461 6 7 8 9 10 -0.0018478099 -0.0014703492 -0.0009604532 -0.0003984813 0.0001909118 11 12 13 14 15 0.0008694375 0.0017723944 0.0029451304 0.0043234390 0.0057278955 16 17 18 19 20 0.0070223601 0.0081077391 0.0090216912 0.0098791881 0.0107300395 21 22 23 24 0.0116063909 0.0125359456 0.0134878181 0.0144412249 $sigma$`bbs(x6, df = dfbase)` 1 2 3 4 5 6 -0.21860927 -0.21538642 -0.21197456 -0.20629754 -0.19256418 -0.16763016 7 8 9 10 11 12 -0.12961304 -0.07657484 -0.01111445 0.05578871 0.11239797 0.15326313 13 14 15 16 17 18 0.18085349 0.19695872 0.20194124 0.20159997 0.20232816 0.20546306 19 20 21 22 23 24 0.21031886 0.21775473 0.22809248 0.24020569 0.25283988 0.26553388 attr(,"offset") [1] -1.650591 > > par(mfrow = c(3,2)) > plot(dat$x3, fitted(model$mu, which = "x3"), main = "mu") > lines(sort(dat$x3), - 3 * sin(dat$x3)[order(dat$x3)], col = "red") > plot(dat$x3, fitted(model$sigma, which = "x3"), main = "sigma") > lines(sort(dat$x3), - 3 * sin(dat$x3)[order(dat$x3)], col = "red") > > model[400] LSS Models fitted via Model-based Boosting Call: gamboostLSS(formula = y ~ ., data = dat, families = NBinomialLSS(), control = boost_control(mstop = 200)) Number of boosting iterations (mstop): mu = 400, sigma = 400 Step size: mu = 0.1, sigma = 0.1 Families: Negative Negative-Binomial Likelihood: mu (log link) Loss function: -(lgamma(y + sigma) - lgamma(sigma) - lgamma(y + 1) + sigma * log(sigma) + y * f - (y + sigma) * log(exp(f) + sigma)) Negative Negative-Binomial Likelihood: sigma (log link) Loss function: -(lgamma(y + exp(f)) - lgamma(exp(f)) - lgamma(y + 1) + exp(f) * f + y * log(mu) - (y + exp(f)) * log(mu + exp(f))) > plot(dat$x3, fitted(model$mu, which = "x3"), main = "mu") > lines(sort(dat$x3), - 3 * sin(dat$x3)[order(dat$x3)], col = "red") > plot(dat$x3, fitted(model$sigma, which = "x3"), main = "sigma") > lines(sort(dat$x3), - 3 * sin(dat$x3)[order(dat$x3)], col = "red") > > model[600] LSS Models fitted via Model-based Boosting Call: gamboostLSS(formula = y ~ ., data = dat, families = NBinomialLSS(), control = boost_control(mstop = 200)) Number of boosting iterations (mstop): mu = 600, sigma = 600 Step size: mu = 0.1, sigma = 0.1 Families: Negative Negative-Binomial Likelihood: mu (log link) Loss function: -(lgamma(y + sigma) - lgamma(sigma) - lgamma(y + 1) + sigma * log(sigma) + y * f - (y + sigma) * log(exp(f) + sigma)) Negative Negative-Binomial Likelihood: sigma (log link) Loss function: -(lgamma(y + exp(f)) - lgamma(exp(f)) - lgamma(y + 1) + exp(f) * f + y * log(mu) - (y + exp(f)) * log(mu + exp(f))) > plot(dat$x3, fitted(model$mu, which = "x3"), main = "mu") > lines(sort(dat$x3), - 3 * sin(dat$x3)[order(dat$x3)], col = "red") > plot(dat$x3, fitted(model$sigma, which = "x3"), main = "sigma") > lines(sort(dat$x3), - 3 * sin(dat$x3)[order(dat$x3)], col = "red") > > proc.time() user system elapsed 5.14 0.42 5.54