Extracted main text — title through conclusion, appendix excluded. This is what our citation measures are computed over, published so the extraction can be checked by eye.
134,527 characters · 15 sections · 72 citation commands
Online Distributional Regression
\orcid{0009-0008-1409-9677} \email{[email removed]} \email{[email removed]}
\orcid{0000-0002-4944-9074} \email{[email removed]} \email{[email removed]} \orcid{0000-0002-2974-2660}
Working Paper -- This Version: January 14, 2026
Large-scale streaming data are common in modern applications of machine learning and have led to the development of online learning algorithms cesa2021online. For processes driven by a high-dimensional covariate space, regularized algorithms have been presented by, e.g., angelosante2010online, yang2010online, monti2018adaptive, yang2023online. In many settings, online statistical algorithms are used to issue forecasts. The advent of probabilistic forecasting in many fields, such as supply chain management, weather and meteorology, energy markets, and finance, yields the need not only for accurate learning of the conditional expected value but also for learning the conditional moments gneiting2014probabilistic, nowotarski2018recent, alvarez2021probabilistic, petropoulos2022forecasting, ziel2022m5. However, online learning approaches for distributional regression remain sparse in the literature and can be grouped as:
and, to the best of our knowledge, there are no regularized online distributional regression approaches suitable for high-dimensional covariate processes available so far.
In this paper, we provide a regularized online learning algorithm for the conditional distribution parameters of the response variable $Y$ based on a combination of the online coordinate descent (OCD) algorithm introduced by angelosante2010online and messner2019online and the generalized additive models for location, scale and shape (GAMLSS) introduced by rigby2005generalized, stasinopoulos2008generalized, stasinopoulos2018gamlss. Formally, the GAMLSS framework assumes that {\color{black} the $N$-dimensional vector of response variables $\ensuremath{\boldsymbol{\mathbf{y}}} = \ensuremath{(y_1, \ldots, y_N)^\top}$} {\color{black} follows} the probability density function (PDF) $$f_{y} \left(y_n \mid \mu_n, \sigma_n, \nu_n, \tau_n \right) \quad {\color{black} \Leftrightarrow \quad f_Y\left(y_n \mid \theta_{n,1}, \theta_{n,2}, \theta_{n,3}, \theta_{n,4} \right)} $$ with (up to) four distribution parameters, each of which can be a (linear) function of explanatory variables. The first two parameters, $\mu_n$ and $\sigma_n$, commonly characterize the location and scale of the distribution, while $\nu_n$ and $\tau_n$ are commonly denoted as the shape parameters describing the skewness and kurtosis. {\color{black} Based on } rigby2005generalized we define the parametric GAMLSS as follows:
where $\mathcal{F}$ is {\color{black} a user-chosen} distribution with {\color{black} $K$ distribution parameters $\theta_{n,k}$ and $\ensuremath{\boldsymbol{\mathbf{\theta}}}_{n, \mathbin{\vcenter{\hbox{\scalebox{0.5}{$\bullet$}}}}} = (\theta_{n,1}, \ldots, \theta_{n,K})$.} {\color{black} Generally, we use subscript $\mathbin{\vcenter{\hbox{\scalebox{0.5}{$\bullet$}}}}$ for indexing a column/row of a matrix. Depending on the domain of $Y$, the distribution's $\mathcal{F}$ support should match $\mathbb{R}$, the positive line $\mathbb{R}^+$, or an appropriate subset.} Let $g_k(\mathbin{\vcenter{\hbox{\scalebox{0.5}{$\bullet$}}}})$ be a known, monotonic link function relating a distribution parameter to a predictor $\ensuremath{\boldsymbol{\mathbf{\eta}}}_{\mathbin{\vcenter{\hbox{\scalebox{0.5}{$\bullet$}}}}, k}$ by {\color{black}
where $\ensuremath{\boldsymbol{\mathbf{x}}}_j$ are the columns of the covariate matrix $\ensuremath{\boldsymbol{\mathbf{X}}}_k$, $\mathcal{J}_k$ is the index set for the linear effects, $\beta_{k,j}$ the distributional regression coefficients to be estimated. $b_{k,j}(\ensuremath{\boldsymbol{\mathbf{x}}}_{j})$ defines non-linear additive effects that can be represented by a linear combination of basis functions, $$b_{k,j}(\ensuremath{\boldsymbol{\mathbf{x}}}_{j}) = \sum^{D_{k,j}}_{l=1} \beta_{k,j,l} \phi_{k,j,l}(\ensuremath{\boldsymbol{\mathbf{x}}}_{j})$$ for some basis function $\phi_{k,j,l}(\mathbin{\vcenter{\hbox{\scalebox{0.5}{$\bullet$}}}})$ and the chosen set of additive effects $\mathcal{B}_k$; yielding the basis functions $\ensuremath{\boldsymbol{\mathbf{\phi}}}_{k,j}= \{\phi_{k,j,1}, \phi_{k,j,2},\ldots,\phi_{k,j,D_{k,j}}\}$ with $ |\ensuremath{\boldsymbol{\mathbf{\phi}}}_{k,j}| = D_{k,j}$. This class of additive effects includes e.g., B-Splines, or (smooth) ReLU-based splines muschinski2022cholesky, kneib2023rage, klein2024distributional and allows us to remain linear in the coefficients. Therefore, without loss of generality, we can rewrite the model in Equation (ref) as
where the model matrix $\ensuremath{\boldsymbol{\mathbf{X}}}_k = (\ensuremath{\boldsymbol{\mathbf{1}}}, (\ensuremath{\boldsymbol{\mathbf{x}}}_{j})_{j\in \mathcal{J}_k}, (\ensuremath{\boldsymbol{\mathbf{\phi}}}_{kjl}(\ensuremath{\boldsymbol{\mathbf{x}}}_j) )_{j\in \mathcal{B}_k, l=1,\ldots, D_{k,j} } )$ is of size $N \times J_k$ where $J_k = 1+ |\mathcal{J}_k| + \sum_{j\in \mathcal{B}_k} D_{k,j}$ and $\ensuremath{\boldsymbol{\mathbf{\beta}}}_k$ is the according linear coefficient vector and $|\mathbin{\vcenter{\hbox{\scalebox{0.5}{$\bullet$}}}}|$ is the cardinality.} The {\color{black} parametric GAMLSS model} therefore allows the modeling of all conditional distribution parameters as {\color{black} non-}linear, additive functions of the explanatory variables in $\ensuremath{\boldsymbol{\mathbf{X}}}_k$. {\color{black} rigby2005generalized introduced estimation via iteratively reweighted least squares (IRLS), which has been extended to LASSO-type penalties by groll2019lasso. Further regularized estimation approaches have been proposed by ziel2021gamlss.} {\color{black} Alternatively, estimation via Bayesian approaches (direct and via Bayesian-IRLS), direct likelihood minimization using stochastic gradient descent thielmann2024neural,umlauf2024scalable and gradient-boosted decision trees maerz2019xgboostlss, cevid2022distributional are popular. }
{\color{black} The aforementioned methods concern the batch estimation of distributional regression models. However, in many applications, we regularly receive new data. Formally,} after having received the first $N$ observations, we receive a new pair set of data $y_{N+1}$ and $\ensuremath{\boldsymbol{\mathbf{x}}}_{N+1, k}$. In the online setting, we are interested in updating the {\color{black} coefficients} of the model $\ensuremath{\boldsymbol{\mathbf{\beta}}}_k$, without recalling all previous observations. We {\color{black} hence} consider an algorithm for a strict online setting in which we can discard all observations after updating the model coefficients. Our proposed algorithm {\color{black} builds on} the IRLS algorithm proposed by rigby2005generalized and exploits its agnosticism towards the estimation method {\color{black} within each iteration. This allows us to exchange the used batch estimation methods with online estimation methods --- including sparse and regularized estimation approaches --- and thereby propose an algorithm suitable for streaming data.}
Figure (ref) gives an idea of the building blocks of our algorithm. In summary, we make the following contributions to the current literature:
Our work opens multiple avenues for future research. First, our implementation is constrained to {\color{black} parametric GAMLSS models, and hence only allows for non-linear additive effects that can be expressed as a sum of basis functions and linear coefficients. While this class includes a wide array of non-linear effects and can be estimated in a regularized way by the proposed sparse estimation methods,} the inclusion of smooth terms, random effects, and regularized P-splines seems like a worthwhile extension rigby2005generalized, eilers1996flexible. Furthermore, the inclusion of autoregressive and cross-moments effects can provide valuable tools for modeling highly complex {\color{black} time series} processes such as weather, electricity markets, or supply chain applications. Lastly, a thorough theoretical analysis of the error bounds of the proposed online approximation compared to the batch setting should further increase the trust in the presented methods.
{\color{black} The remainder of this paper is structured by the {\color{black} flow given in Figure (ref).} The following two sections give the building blocks of our algorithm: First, Section (ref) briefly reviews the algorithm for the parametric GAMLSS. Afterwards, Section (ref) reviews online estimation of regularized linear models. Section (ref) presents our main contribution, the online distributional regression. The following Sections (ref) and (ref) present a simulation study on the properties of the online algorithm and our real-world application for energy markets. Section (ref) presents our open-source implementation. Finally, Section (ref) discusses our results and concludes the paper.}paper.}
{\color{black}
} {\color{black} We denote scalar values as lowercase letters $a$, vectors as bold lowercase letters $\ensuremath{\boldsymbol{\mathbf{a}}} = (a_1, \ldots, a_N)$ and matrices as bold uppercase letters $\ensuremath{\boldsymbol{\mathbf{A}}} = (\ensuremath{\boldsymbol{\mathbf{a}}}_1, \ldots, \ensuremath{\boldsymbol{\mathbf{a}}}_M)$. For an arbitrary matrix $\ensuremath{\boldsymbol{\mathbf{A}}}$, $\ensuremath{\boldsymbol{\mathbf{A}}}_{n, \mathbin{\vcenter{\hbox{\scalebox{0.5}{$\bullet$}}}}}$ denotes accessing the $n$-th row, while $\ensuremath{\boldsymbol{\mathbf{A}}}_{\mathbin{\vcenter{\hbox{\scalebox{0.5}{$\bullet$}}}}, i}$ denotes accessing the $i$-th column. We denote element-wise or Hadamard multiplication using $\odot$ and element-wise division using $\oslash$, that is $\ensuremath{\boldsymbol{\mathbf{a}}} \oslash \ensuremath{\boldsymbol{\mathbf{b}}} = \ensuremath{\boldsymbol{\mathbf{a}}} \odot \ensuremath{\boldsymbol{\mathbf{b}}}^{-1}$ for vectors.} {\color{black} The following exposition of the IRLS algorithm for fitting distributional regression models largely follows rigby2005generalized and stasinopoulos2008generalized. The full algorithm} is outlined in Algorithm (ref). {\color{black} Our algorithm follows the RS-Algorithm (Rigby & Stasinopoulos Algorithm), although an implementation of the GC-Algorithm (Cole & Green Algorithm) is possible as well.} {\color{black} {\color{black} We start with the distributional regression model from the introduction given in Equations (ref) and (ref):
} and, without loss of generality, we assume that the same set of covariates is used for all distribution parameters $k \in 1, \ldots, K$ and therefore $\ensuremath{\boldsymbol{\mathbf{X}}}_k = (\ensuremath{\boldsymbol{\mathbf{1}}}, (\ensuremath{\boldsymbol{\mathbf{x}}}_{j})_{j\in \mathcal{J}_k}, (\ensuremath{\boldsymbol{\mathbf{\phi}}}_{k,j,l}(\ensuremath{\boldsymbol{\mathbf{x}}}_j) )_{j\in \mathcal{B}_k, l=1,\ldots, D_{kj} } )$. Let $\ensuremath{\boldsymbol{\mathbf{\theta}}}_k = \ensuremath{\boldsymbol{\mathbf{\theta}}}_{\mathbin{\vcenter{\hbox{\scalebox{0.5}{$\bullet$}}}},k}$, $\ensuremath{\boldsymbol{\mathbf{\eta_k}}} = \ensuremath{\boldsymbol{\mathbf{\eta}}}_{\mathbin{\vcenter{\hbox{\scalebox{0.5}{$\bullet$}}}},k} = \ensuremath{\boldsymbol{\mathbf{\eta}}}_{\mathbin{\vcenter{\hbox{\scalebox{0.5}{$\bullet$}}}},k}(\ensuremath{\boldsymbol{\mathbf{\theta}}}_k)$ and let $\ell(y_n \mid \ensuremath{\boldsymbol{\mathbf{\theta}}}_{n, \mathbin{\vcenter{\hbox{\scalebox{0.5}{$\bullet$}}}}}) = \log(\mathcal{L}(y_n \mid \ensuremath{\boldsymbol{\mathbf{\theta}}}_{n, \mathbin{\vcenter{\hbox{\scalebox{0.5}{$\bullet$}}}}}))$ denote the log-likelihood function of the assumed distribution $\mathcal{F}$. We use the shorthand $\ensuremath{\boldsymbol{\mathbf{\ell}}} = \ensuremath{\boldsymbol{\mathbf{\ell}}}(\ensuremath{\boldsymbol{\mathbf{\theta}}}) =\ell(\ensuremath{\boldsymbol{\mathbf{y}}} \mid \ensuremath{\boldsymbol{\mathbf{\theta}}})$. Then
}tion} } denotes the score vectors. Generally, partial derivatives are evaluated element-wise, hence $\partial \ensuremath{\boldsymbol{\mathbf{\ell}}} / \partial \ensuremath{\boldsymbol{\mathbf{\eta}}}_k$ is a vector of length $N$ with the elements $\partial \ell(y_n \mid \ensuremath{\boldsymbol{\mathbf{\theta}}}_{n, \mathbin{\vcenter{\hbox{\scalebox{0.5}{$\bullet$}}}}}) / \partial \eta_{nk}$. Let
be the adjusted dependent variables, also called the working vector. $\ensuremath{\boldsymbol{\mathbf{W}}}_{k,s}$ is a diagonal, iterative weight matrix, which can have one of the following forms: {\color{black}
giving the observed (Newton-Raphson), expected (Fisher-Scoring) or product (quasi Newton-Raphson) score function rigby2005generalized. Note that differentiation is again evaluated element-wise and the full Hessian tensor $\ensuremath{\boldsymbol{\mathbf{H}}}$ is of size $N \times K \times K$. Combining Equations (ref) and the RS and CG algorithms gives six possible combinations of the RS and CG algorithms and the three score types. In the following, we focus on the RS algorithm with Fisher scoring, but the other combinations can be implemented similarly. Using the chain rule and Fisher's identity, we have that:
The Fisher information matrix can be recovered as the variance of the score function or as the second derivative of the log-likelihood with respect to the predictor. Hence, the adjusted observation vector or working vector $\ensuremath{\boldsymbol{\mathbf{z}}}_k$ reads:
where we note that the weight matrix $\ensuremath{\boldsymbol{\mathbf{W}}}_{k,k}$ evaluated at the diagonal only. Therefore its inverse corresponds to $\operatorname{diag}(\ensuremath{\boldsymbol{\mathbf{W}}}_{k,k})^{-1}$ and the multiplication with the score vector is element-wise.} In the implementation, we regularly employ that:
where $g_k^{-1}(\ensuremath{\boldsymbol{\mathbf{\eta}}}_k) = \ensuremath{\boldsymbol{\mathbf{\theta}}}_k$ is the inverse of the link function. For pseudo-Newton methods, similar results hold. This allows for a mix-and-match implementation of link functions and distributions, since we only need the Jacobian, potentially the Fisher Information and the first derivative of $g_k^{-1}(\cdot)$ rigby2005generalized, stasinopoulos2008generalized, stasinopoulos2024generalized, however, hirsch2025online show that true Newton-Raphson methods additionally need the second derivative of $g_k^{-1}(\cdot)$ to allow for a similar mix-and-match implementation of the link functions and distributions.
{\color{black} The iteratively reweighted least squares algorithm rigby2005generalized for the estimation of distributional regression models is given in Algorithm (ref) and consists of two nested cycles. Let $r$ and $i$ be the indices for the outer and inner cycle. The outer cycle maximizes the penalized likelihood with respect to $\ensuremath{\boldsymbol{\mathbf{\beta}}}_k$. Within each outer cycle, the algorithm iterates through the distribution parameters $k = 1, \ldots, K$. For each distribution parameter $\ensuremath{\boldsymbol{\mathbf{\theta}}}_k$ the inner cycle consists of repeated, weighted regression of the score {vector $\ensuremath{\boldsymbol{\mathbf{z}}}_k^{[r,i]}$} on the design matrix $\ensuremath{\boldsymbol{\mathbf{X}}}_k$ using the iterative weights $\ensuremath{\boldsymbol{\mathbf{W}}}_{k,k}^{[r,i]}$. We denote iterations as superscript, i.e. $\ensuremath{\boldsymbol{\mathbf{\theta}}}^{[r, i]}_k$ is the value of $\ensuremath{\boldsymbol{\mathbf{\theta}}}_k$ at the outer iteration $r$ and the inner iteration $i$. The weighted fit in Line 8 is at the core of the Newton step for the estimation of the conditional distribution parameters. It is important to see that the general algorithm is agnostic to which (weighted) statistical learning method is employed to regress $\ensuremath{\boldsymbol{\mathbf{z}}}_k^{[r,i]}$ on the design matrix $\ensuremath{\boldsymbol{\mathbf{X}}}_k$ using the iterative weights $\ensuremath{\boldsymbol{\mathbf{W}}}_{k,k}^{[r,i]}$ stasinopoulos2024generalized. This has facilitated the development of multiple extensions to the batch GAMLSS, such as gamlss.boost mayr2012generalized, hofner2014gamboostlss, mixtures with Neural Networks rugamer2024semi, and regularized approaches as in groll2019lasso and gamlss.lasso ziel2021gamlss. We do not include the backfitting iteration here as we constrain ourselves to non-linear additive effects that can be represented as a combination of basis functions of $\ensuremath{\boldsymbol{\mathbf{X}}}_k$.}
{\color{black} Lastly, let us discuss two important aspects of using iteratively reweighted least squares for the estimation of distributional regression models using a concrete example. The calculation of the score vector, working vector, and weights depends on the distributional assumption and the chosen link function. Remark (ref) introduces a simple Gaussian example and gives the concrete working vectors and weights.
The working vectors $\ensuremath{\boldsymbol{\mathbf{z}}}_1, \ensuremath{\boldsymbol{\mathbf{z}}}_2$ and weights $\ensuremath{\boldsymbol{\mathbf{W}}}_{1,1}$ equal the working vectors used to estimate mean-variance models for conditional heteroskedasticity using least-squares estimation, where $\ensuremath{\boldsymbol{\mathbf{W}}}_{2,2}$ is often omitted and set as constant $\ensuremath{\boldsymbol{\mathbf{W}}}_{2,2} = 1$ francq2019garch. For this approach, consistent model selection using the adaptive LASSO and asymptotic normality of the estimators have been shown by dette2013least for independent observations and ziel2016iteratively for time series settings. The weights $\ensuremath{\boldsymbol{\mathbf{W}}}_{2,2}$ in Remark (ref) additionally correct for heteroskedasticity in the estimation of the conditional scale parameter. groll2019lasso discuss LASSO estimation in the general setting of distributional regression in an application and simulation study; however, general results on consistent model selection are, to the best knowledge of the authors, not available. }
The working vectors (Equation (ref) in Remark (ref)) also underscore an important fact in distributional modeling: {\color{black} The models for the conditional distribution parameters depend on each other. Therefore, errors due to low-quality models for one distribution parameter can propagate through the distributional model and adversely affect the estimation of other distribution parameters. This can lead to hard-to-predict effects in the estimation, if the distribution parameters are not information-orthogonal cox1987parameter. There is a directional component to this issue, as there is no hope in estimating the conditional scale correctly if the model for the location is misspecified, while the impact of a misspecified scale model on the location is not as severe. For models with conditional skewness and tail behavior, the issue can be even more severe, as the relationships might be highly non-linear. This issue is discussed in detail in the context of the M5 competition in ziel2022m5.}
Let us now move to the online or streaming setting. For the sake of simplicity, we assume we are in a regular regression {\color{black} to the mean} setting and omit the subscript $k$ for the distribution parameter used in the previous subsection. The issue at hand can be summarized as follows: given some data $\ensuremath{\boldsymbol{\mathbf{y}}}_N=\ensuremath{(y_1,\ldots, y_N)^\top}$, $\ensuremath{\boldsymbol{\mathbf{X}}}_N = (\ensuremath{\boldsymbol{\mathbf{x}}}_1, \ldots, \ensuremath{\boldsymbol{\mathbf{x}}}_N)$ and weights $\ensuremath{\boldsymbol{\mathbf{W}}}_N = \operatorname{Diag}\left(w_1, \ldots, w_N \right)$ we have estimated a set of coefficients $\widehat{\ensuremath{\boldsymbol{\mathbf{\beta}}}}_N$. We are now interested in recovering the coefficients $\widehat{\ensuremath{\boldsymbol{\mathbf{\beta}}}}_{N+1}$, given a new observation for $y_{N+1}$, a new row of $\ensuremath{\boldsymbol{\mathbf{x}}}_{N+1}$ and a new weight $w_{N+1}$. {\color{black} In slight abuse of notation, we employ the subscripts $N$, and $N+1$ to indicate which data is available to the forecaster by now, thereby $\ensuremath{\boldsymbol{\mathbf{y}}}_{N+1} = (y_1, \ldots, y_N, y_{N+1})$ and $\ensuremath{\boldsymbol{\mathbf{X}}}_{N+1} = (\ensuremath{\boldsymbol{\mathbf{x}}}_1, \ldots, \ensuremath{\boldsymbol{\mathbf{x}}}_N, \ensuremath{\boldsymbol{\mathbf{x}}}_{N+1})$. We employ this notation exclusively around the updating step $N \rightarrow N+1$.} The following two sections review the estimation of weighted linear models using recursive least squares (Section (ref)) and the incremental estimation of $L_1$ and $L_2$ penalized linear models using online coordinate descent (OCD, see Section (ref)).
The following is a condensed introduction haykin2014adaptive {\color{black} to recursive estimation for weighted least squares estimation}. {\color{black} Nevertheless, it is useful to emphasize a few points that will be of interest for the online distributional learning algorithm introduced in Section (ref).} The weighted least squares regression problem estimates the coefficients $\widehat{\ensuremath{\boldsymbol{\mathbf{\beta}}}}_N^\text{WLS}$ that minimize the loss:
by noting that $\ensuremath{\boldsymbol{\mathbf{W}}}_N$ is invertible as long as all weights are positive and non-zero. {\color{black} Define the weighted Gramian $\ensuremath{\boldsymbol{\mathbf{G}}}_N = \ensuremath{\ensuremath{\boldsymbol{\mathbf{X}}}_N^\top}\ensuremath{\boldsymbol{\mathbf{W}}}_N\ensuremath{\boldsymbol{\mathbf{X}}}_N$.} Under the assumptions that (1) the weights are known and (2) do not change for past observations, the weighted least-squares problem can be re-formulated as a recursive algorithm for the next observations $y_{N+1}$ and covariates. {\color{black} These assumptions are in general not an issue if one is using sample weights. We will return to these assumptions in Section (ref) for the case of estimation weights. In either case, the weights should be living on a consistent scale. By employing the Sherman-Morrison formula (see Appendix (ref)), we can efficiently update the Gramian matrix by taking
and we receive
where the latter Equation (ref) gives a convenient update equation for streaming settings.} An important special case is the recursive least squares with exponential forget, which minimizes the loss {\color{black}
where $$\ensuremath{\boldsymbol{\mathbf{\Gamma}}}_N = \operatorname{Diag}\left((1-\gamma)^{N-1}, (1-\gamma)^{N-2}, \ldots,(1-\gamma)^{1}, (1-\gamma)^{0} \right)$$ and $\gamma$ denotes the forget factor. We} note that the exponential discounting of older observations leads to
and the {\color{black} corresponding} update equation for the exponentially discounted inverted Gram matrix
which allows for an efficient online update of the OLS coefficients under exponential forgetting by using Equation (ref) and setting $w_{N+1} = 1$. {\color{black} Note the subtle difference between Equation (ref) for updating the inverse Gramian matrix with sample weights $\ensuremath{\boldsymbol{\mathbf{W}}}_N$ and Equation (ref) using discounting weights $\ensuremath{\boldsymbol{\mathbf{\Gamma}}}_N$, as the sample weights are constant, but the unique structure of exponential discounting allows the weights $(1-\gamma)^n$ to depend on the distance to the current newest observation.}
Lastly, we combine sample weights and exponential discounting: For the exponentially discounted, weighted Gram matrix $\ensuremath{\boldsymbol{\mathbf{G}}}_N = (\ensuremath{\ensuremath{\boldsymbol{\mathbf{X}}}_N^\top} \ensuremath{\boldsymbol{\mathbf{\Gamma}}}_N \ensuremath{\boldsymbol{\mathbf{W}}}_N \ensuremath{\boldsymbol{\mathbf{X}}}_N)$, we have
and accordingly the update of the inverted Gram matrix $\ensuremath{\boldsymbol{\mathbf{G}}}_{N+1}^{-1}$ can be written as:
which can be plugged into Equation (ref) to update the coefficients $\widehat{\ensuremath{\boldsymbol{\mathbf{\beta}}}}$, as in Algorithm (ref).
{\color{black} The recursive least squares estimator can be numerically unstable due to its reliance on the inverted Gramian matrix $\ensuremath{\boldsymbol{\mathbf{G}}}_N^{-1}$. Furthermore, for regression problems with large sets of potential covariates, some regularization is commonly employed to keep a parsimonious model. The elastic net friedman2010regularization, friedman2007pathwise minimizes a combination of $L_1$ (or LASSO) and $L_2$ (or Ridge) penalties on the coefficient vector and is commonly written as:
where the ratio between $L_1$ and $L_2$ penalties is governed by $\alpha$. From the elastic net, we can recover ordinary least squares ($\lambda = 0$), the LASSO ($\alpha=1$), and the ridge regression ($\alpha=0$). In the batch setting, } friedman2007pathwise, friedman2010regularization introduced path-wise cyclic coordinate descent (CCD) for elastic net regression problems, {\color{black} and due to its computational efficiency, it remains the state-of-the-art method for coefficient estimation}. For given regularization parameters {\color{black} $\lambda_1$ and $\lambda_2$}, we repeatedly update the coefficient vector $\ensuremath{\boldsymbol{\mathbf{\beta}}}_N = (\beta_{N,1}, \ldots, \beta_{N,J})$ of length $J$ and update {\color{black}
} where $S(\beta, \lambda) = \text{sign}(\beta) \max(\lvert \beta \rvert - \lambda, 0)$ is the soft-thresholding function {\color{black} and $y_n - \tilde{y}_n^{(j)} = y_n - \widehat{y}_n + x_{nj}\widehat{\beta}_j$ is the partial residual excluding the contribution of $x_{nj}$}. Note that, implicitly, friedman2010regularization assume that $\sum_{n=1}^N w_n = 1$. We use a numerical convergence criterion to {\color{black} terminate} the algorithm after convergence.
As proposed in angelosante2010online and messner2019online for LASSO estimation, we rewrite the update Equation (ref) to calculate the updated parameter from the weighted Gramian matrix $\ensuremath{\boldsymbol{\mathbf{G}}}_N = \ensuremath{\ensuremath{\boldsymbol{\mathbf{X}}}^\top}_N\ensuremath{\boldsymbol{\mathbf{W}}}_N\ensuremath{\boldsymbol{\mathbf{X}}}_N$ and the {\color{black} vector $\ensuremath{\boldsymbol{\mathbf{h}}}_N = \ensuremath{\ensuremath{\boldsymbol{\mathbf{X}}}^\top}_N\ensuremath{\boldsymbol{\mathbf{W}}}_N\ensuremath{\boldsymbol{\mathbf{y}}}_N$} and their potentially exponentially discounted counterparts (see Section (ref) and Equation (ref)). {\color{black} Since $\ensuremath{\boldsymbol{\mathbf{G}}}_N$ and $\ensuremath{\boldsymbol{\mathbf{h}}}_N $ can be updated online, this allows an efficient incremental estimation on a data stream.} {\color{black} We observe for the elements $G_{N,j,j}$ and $h_{N,j}$ of $\ensuremath{\boldsymbol{\mathbf{G}}}_{N}$ and $\ensuremath{\boldsymbol{\mathbf{h}}}_{N}$ that
Thus, writing the nominator inside the soft-thresholding function as
and} we receive the {\color{black} update equation for the elastic net as} {\color{black}
} Therefore, the algorithm only needs to store the $J \times J$ {{matrix $\ensuremath{\boldsymbol{\mathbf{G}}}_N$}} and the {{$J$-dimensional vector\;$\ensuremath{\boldsymbol{\mathbf{h}}}_N$}}. {\color{black} Once a new pair of observations arrives, we can update $\ensuremath{\boldsymbol{\mathbf{G}}}_{N+1}$ and $\ensuremath{\boldsymbol{\mathbf{h}}}_{N+1}$ and re-run the cyclic coordinate descent based on the previous estimated coefficients.} {\color{black} As in batch} coordinate descent, we can run the algorithm for a decreasing sequence of regularization strengths $\lambda$, starting with $\lambda_\text{max} = \max{}\lvert \ensuremath{\boldsymbol{\mathbf{h}}}_N \rvert$ as the element-wise maximum in $\ensuremath{\boldsymbol{\mathbf{h}}}_N$ and using an exponential grid towards $\lambda_\text{min} = \epsilon \lambda_\text{max}$ with $\epsilon_\lambda = 0.001$ as typical values friedman2010regularization, friedman2007pathwise, messner2019online. {\color{black} Note that, as $\ensuremath{\boldsymbol{\mathbf{h}}}_N$ changes in the online setting with each new pair of observations, the regularization grid varies slowly.} Algorithm (ref) presents the algorithm schematically.
{\color{black} We extend the formulation to allow for the possibility to box-constrain $L_j \leq \beta_j \leq U_j$ with user-chosen bounds $L_j$ and $U_j$. As in the batch implementation in the glmnet R package friedman2010regularization, tay2023elastic, Equation (ref) is then formulated as:
}
Having established the batch IRLS algorithm for the estimation of distributional regression models and the online coordinate descent for regularized linear models, this section proceeds by putting the pieces together and presents the online linear {\color{black} distributional regression} model. {\color{black} Algorithm (ref) outlines the main procedure and we will subsequently describe the details with respect to model selection, mini-batch updates, stopping criteria, and the possible approximation error towards the batch case. We present the algorithm using a path-based, regularized estimation method in each inner iteration, and therefore include model selection; however, using RLS or OCD for unregularized estimation is possible as well.}
{\color{black} We start again with the distributional regression model from the introduction given in Equation (ref) and (ref):
} After having seen $N$ observations, we have estimated coefficients $\widehat{\ensuremath{\boldsymbol{\mathbf{\beta}}}}_{N, k}$ for $k = 1, .., K$ distribution parameters. Given some new data $(y_{N+1}, \ensuremath{\boldsymbol{\mathbf{x}}}_{N+1})$, we aim to update our coefficients towards $\widehat{\ensuremath{\boldsymbol{\mathbf{\beta}}}}_{N+1, k}$. On a high level, for updating the coefficients in the online distributional regression, we do the following steps in the outer cycle: we initialize the predictors ${\eta}_{N+1, k}^{[0, 0]} = g_k\left(\ensuremath{\boldsymbol{\mathbf{x}}}_{N+1, k} \widehat{\ensuremath{\boldsymbol{\mathbf{\beta}}}}_{N, k}\right)$ and this allows us to evaluate $\ensuremath{\boldsymbol{\mathbf{u}}}_{N+1, k}^{[0, 0]}$, ${w}_{N+1, k,k}^{[0, 0]}$ and ${z}_{N+1, k}^{[0, 0]}$. From there, we can update the weighted, exponentially discounted Gramian matrices $\ensuremath{\boldsymbol{\mathbf{G}}}_{N, k} \rightarrow \ensuremath{\boldsymbol{\mathbf{G}}}_{N+1, k}^{[0, 0]}$ and the vectors $\ensuremath{\boldsymbol{\mathbf{h}}}_{N, k} \rightarrow \ensuremath{\boldsymbol{\mathbf{h}}}_{N+1, k}^{[0, 0]}$ {\color{black} by taking
} and subsequently use an online estimation method from Section (ref) to update the coefficients inside the iteration. As in the batch algorithm (see Algorithm (ref)), we run the outer and inner cycles until convergence.
{\color{black} The following paragraphs discuss some points of the algorithm in detail.} To make the discussion clearer, we call an update step a full update for all distribution parameters $\widehat{\ensuremath{\boldsymbol{\mathbf{\theta}}}}_{N, k} \rightarrow \widehat{\ensuremath{\boldsymbol{\mathbf{\theta}}}}_{N+1, k}$ and associated regression coefficients $\widehat{\ensuremath{\boldsymbol{\mathbf{\beta}}}}_{N, k} \rightarrow \widehat{\ensuremath{\boldsymbol{\mathbf{\beta}}}}_{N+1, k}$ for $k = 1, \ldots, K$, while step might refer to any arbitrary step in the algorithm. {\color{black} We start with a few general points and subsequently discuss the issue of model selection (Section (ref)) and the difference between batch and online estimation (Section (ref)) in detail.}
{\color{black} As already hinted at in Section (ref), the estimation of the coefficients $\ensuremath{\boldsymbol{\mathbf{\beta}}}_k$ on a path of regularization parameters yields the need for model selection.} Since distributional regression is a likelihood-based approach, we propose the use of information criteria (IC) for this task. We define the generalized information criterion (GIC) as
where $P$ denotes the number of estimated {\color{black} non-zero coefficients}, $\nu = (\nu_0, \nu_1, \nu_2)$ denotes a triplet of parameters, $\tilde{N}_k = \frac{(1 - \gamma_k^N)}{1 - \gamma_l}$ is the effective training length, and $\widehat{\mathcal{L}}$ denotes the maximized value of the likelihood function of the model. The most commonly used information criteria Akaike's Information Criterion {(AIC, $\nu = (2, 0, 0)$)}, Bayesian Information Criterion {(BIC, $\nu = (0, 1, 0)$)} and the Hannan-Quinn Criterion {(HQC, $\nu = (0, 0, 2)$)} can be recovered from the GIC kim2012consistent, kock2016consistent. {\color{black} From here, we have two options to proceed: we can use local model selection on the level of the distribution parameter $k$, based on the residual sum of squares (RSS) of each inner iteration (Line 8 in Algorithm (ref) and Line 9 in Algorithm (ref)) or global model selection, based on the log-likelihood under the full model.
The local model selection is used, e.g., for the selection of regularization parameters in the backfitting step in the classic GAMLSS algorithm and in the R gamlss.lasso package ziel2021gamlss. It has the advantage of avoiding expensive likelihood evaluations, but relies on the assumptions that the local fit's residuals are approximately Gaussian distributed. Furthermore, the local model selection allows specifying different parameterizations of the GIC for different distribution parameters.} We suggest selecting a {\color{black} more conservative parameterization of the GIC} for higher $k$ to avoid overfitting in modeling the conditional scale, kurtosis, and skewness {\color{black} when using local model selection. We also note that since the coefficients and estimates for different distribution parameters live on very different scales, it can be the case that $\varepsilon_{k, \lambda}$ needs to be smaller, otherwise the lower end of the coefficient path might not approach the OLS solution.} groll2019lasso analyze the impact of different shrinkage parameters on batch distributional regression. Also marcjasz2023distributional see the advantages of different regularization for the distribution parameters when using distributional neural networks for time series forecasting.
An important relationship to the batch version of our proposed algorithm becomes apparent when comparing how weights are updated. In the batch setting, with repeated fits of the {\color{black} model using all observations}, the weight matrix $\ensuremath{\boldsymbol{\mathbf{W}}}_{k,k}^{[r,i]} = \operatorname{Diag}\left(w_{0,k,k},\ldots, w_{N,k,k}\right)$ is updated in every iteration $r,i$ and again, in the next batch fit for $N+1$, the weight matrix is updated for all $w_{n,k,k}$ from $n = 1,\ldots, N+1$ in all iterations. In the online setting, $\ensuremath{\boldsymbol{\mathbf{W}}}_{N,k,k}$ is the weight matrix after convergence of the update step $N-1 \rightarrow N$. In the update step $N \rightarrow N+1$, we cannot update $\ensuremath{\boldsymbol{\mathbf{W}}}_{N,k,k}$ anymore (see also the Assumptions noted in Section (ref)). Therefore, we set
and can only update $w_{N+1, k,k}^{[r,i]}$. Note that due to the update rule in Equation (ref), this effect is counter-weighted by the exponential forget $\gamma$. However, there is a delicate balance to strike to trade off the beneficial effect of the forget and increased instability in the coefficient estimation {\color{black} due to smaller effective sample sizes}. This might lead to slower convergence compared to batch learning if the data is drawn from a stationary process. The online distributional regression is, therefore, an approximation of the repeated batch estimation, contrary to the case for, e.g., RLS or online coordinate descent in the case of regression to the mean, where the update step leads to the equivalent results. When choosing a specific distribution assumption for $\mathcal{F}$ in the IRLS framework, the weight matrix for the {\color{black} distribution parameter} $\theta_k$ in each update step can be recovered with the help of Equations (ref) to (ref). The online weight matrix is retrieved by iteratively inserting the weight matrix in Equation (ref). For illustration, building on the standard linear-Gaussian case for the distributional regression in Remark (ref), we can examine the difference explicitly for the mean equation: {\color{black}
}
From Remark (ref) we see that the difference in the online and batch setting depends on the length of the initial batch {\color{black} $N$, how long the algorithm is running online $M-N$, and the strength of the exponential discounting. Looking at Equation (ref) and keeping in mind that for large sample sizes, $(1-\gamma)^{M}, \ldots, (1-\gamma)^{M-n}$ will eventually approach values close to zero, it is tempting to conclude that for sufficiently high discounting and after a sufficiently large number of online updates $M$ the first term of Equation (ref) ceases to influence the estimation.\footnote{Precisely, when $(1-\gamma)^{(N-M)} \rightarrow 0$ the observations that are in the initial sample receive a weight of zero.} However, due to the path-dependency of the online algorithm, where each update step's weight depends on the previous update step, this argument does not hold. For different combinations of the distribution $\mathcal{F}$, link functions $g_k(\mathbin{\vcenter{\hbox{\scalebox{0.5}{$\bullet$}}}})$, and distribution parameter $k$ the exact form of the above weights might be significantly more complex. This result shows a main difference to the regression to the mean} setting, where the batch and online results coincide {\color{black} for OCD and RLS algorithms}.
\FloatBarrier
{\color{black} This section presents three distinct simulation studies on different aspects of the online distributional regression model. We analyze timings, the impact of the length of the initial training set, and the forgetting factor. Here, the data-generating process (DGP) is similar for all three studies. We consider a setting where $\ensuremath{\boldsymbol{\mathbf{y}}}$ is normally distributed. The location and scale parameters depend on the $N \times J$ covariate matrix $\ensuremath{\boldsymbol{\mathbf{X}}} =\ensuremath{\boldsymbol{\mathbf{X}}}_{1} = \ensuremath{\boldsymbol{\mathbf{X}}}_{2}$. We simulate the entries of $\ensuremath{\boldsymbol{\mathbf{X}}}$ by a $J$-dimensional normal distribution ${\ensuremath{\boldsymbol{\mathbf{X}}}_{i} \sim \mathcal{N}( 0_J, I_J/2)}$ and define
with $g(x, \alpha) = \log\left(1 + e^{x}\right) + \alpha$, a shifted softplus link function. Accordingly, we use a shifted softplus link function for estimating the scale parameter of the normal distribution. We set $\alpha=0.5$ to ensure sufficiently large variances. This greatly improves the stability of the estimations. The coefficient vectors $\ensuremath{\boldsymbol{\mathbf{\beta}}}_k$ of length $J$ are drawn from the uniform distribution:
Unless mentioned otherwise, we set $J=10$, use $N=10000$ observations, use $2000$ observations for the initial fit, and execute 10 simulation runs.
}
\FloatBarrier
The following section presents an application in electricity price forecasting (EPF). We employ the same setting as marcjasz2023distributional and brusaferri2024line in forecasting day-ahead electricity prices for the German short-term electricity market. We directly compare the forecasting performance of online estimation vs repeated batch estimation directly for models using the Gaussian, Student-$t$, and Johnson $S_U$ (JSU) distribution and for OLS/RLS and LASSO estimation (see Table (ref)). Furthermore, we compare our approach to established benchmark models from the literature and conduct several ablation studies (see Appendix (ref), Tables (ref) and (ref)). The following paragraphs describe the German day-ahead electricity market, data set, and models in detail.
Let $h \in \{0, 1, \ldots, H\}$ and $H=23$ denote the 24 delivery hours and $d$ denote the delivery day. The day-ahead electricity market serves as the main trading venue for electricity and as reference price for the long-term futures market. It is organized as a daily auction at $d-1$, 12:00 hours for all 24 delivery hours of the following day, {\color{black} where electricity generators, consumers, and traders can place price-volume bids to buy and sell electricity in each delivery hour. The market is cleared in a pay-as-cleared auction, taking into account the available transfer capacity between the European countries} viehmann2017state, marcjasz2023distributional, ziel2018day, lago2018forecasting, epftoolbox. {\color{black} Figure (ref) gives an overview of the electricity price time series, the residual load (system load minus renewable energy production), and fuel prices for conventional generation assets. The residual load is the amount of electricity production that has to be covered by conventional generation sources (e.g., gas, coal, and oil). From an economic point of view, the renewable generation is often assumed to operate at zero or even negative marginal costs, while conventional power plants need to cover fuel and emission certificate costs, and therefore, the residual load is an important factor in the price formation.} The data is retrieved from marcjasz2023distributional\footnote{See \url{https://github.com/gmarcjasz/distributionalnn}. marcjasz2023distributional provide data from the European Network of Transmission System Operators (ENTSO-E) and Refinitiv.} The initial training set comprises 2015-01-15 to 2019-06-26 (1631 days), and the test set comprises 2019-06-26 to 2020-12-31 (534 days). This is in line with the test and training split of brusaferri2024line and marcjasz2023distributional.
We employ a so-called expert-type model as it is common in electricity price forecasting lago2018forecasting, ziel2018day, marcjasz2023distributional. The model consists {\color{black} of 43 linear terms and of 5 non-linear additive effects modeled by B-Spline bases. The covariates capture} the autoregressive price effects, seasonal effects, the fundamental effects of renewable generation, and the influence of fuel prices. We employ the {\color{black} Gaussian}, Student-$t$, and Johnson's $S_U$ (JSU) distributions. {\color{black} The Gaussian distribution serves as a benchmark, and the latter two} have been used for electricity price forecasting and other financial applications. In the distributional framework, we model each distribution parameter $k = 1, \ldots, p$ for each delivery hour $h = \{0, 1, \ldots, H\}$ individually:
where $\beta_{k, 0, h}$ is the intercept or bias, $\beta_{k, 1, h}$ to $\beta_{k, 30, h}$ capture autoregressive effects for the previous day $d-1$, all delivery hours, and for the last 7 days of the same delivery hour $h$. $\beta_{k, 31, h}$ to $\beta_{k, 34, h}$ capture the influence of very large and low prices for the previous day. $\beta_{k, 35, h}$ models the influence of the daily residual load. $\beta_{k, 36, h}$ to $\beta_{k, 42, h}$ capture the effects of weekly seasonality and holidays.\footnote{German public holidays are taken from the Python holidays package. On a public holiday, we set all other weekday dummies to zero. The holiday days include New Year's, Good Friday, Easter Monday, Labor Day, Ascension Day, Whit Monday, German Unity Day, and Christmas.} Lastly, the terms $b_{k,1,h}(\mathbin{\vcenter{\hbox{\scalebox{0.5}{$\bullet$}}}})$ to $b_{k,5}$ capture the non-linear effects of hourly residual load, European Emission Allowances (EUAs), natural gas, coal and oil prices by B-Splines of degree 2 and using 4 knots, placed according to the quantiles of the covariates in the training set eilers1996flexible.
We benchmark forecasts using established, strictly proper probabilistic scoring rules gneiting2008probabilistic, gneiting2011making, gneiting2014probabilistic, nowotarski2018recent. For the mean prediction, we employ the Root Mean Squared Error (RMSE), and {\color{black} for the median prediction, we use the} Mean Absolute Error (MAE). We evaluate the Coverage (COV) and the Interval Score bracher2021evaluating for the {\color{black} 50% and 80%} prediction intervals (PI). For the full predictive distribution, we evaluate the Log Score (LS) and the continuous ranked probability score (CRPS) using the approximation via the Pinball Score (PS) on a dense grid of quantiles $\mathcal{Q} = \{0.01, 0.02, 0.03, \ldots, 0.99\}$. The implementation of the scoring rules is provided by the scoringrules package zanetta_scoringrules_2024. We evaluate the statistical significance of the difference in predictive accuracy using the Diebold-Mariano test diebold2002comparing, diebold2015comparing. {\color{black} For the coverage, we evaluate the Kupiec-test (see kupiec1995techniques) per hour $h$. Detailed definitions of the scoring rules and the statistical tests can be found in Appendix (ref)}. Lastly, we evaluate the computation time for all forecasting studies.
The following section presents and discusses the results of the forecasting study. Figure (ref) gives an exemplary forecast. The time-varying width of the prediction intervals illustrates the importance of modelling the conditional volatility. Figure (ref) shows the non-linear effects of residual load on the scale parameter (A similar Figure for the location $\mu$ can be found in Appendix (ref)). The effect is $u$-shaped, indicating that the price volatility increases for very high and very low residual load levels. This is in line with economic theory, as extreme residual load levels indicate scarcity or oversupply situations, which lead to more volatile prices.
Table (ref) presents our main results, the direct comparison of repeated batch and online estimation for the distributional regression model. We make the following observations about the predictive performance in our forecasting study:
Furthermore, we make the following observations when comparing to established benchmarks and conducting ablation studies:
Wrapping up, our study demonstrates that online distributional regression models achieve competitive predictive performance compared to both traditional time-series benchmarks and advanced neural network-based approaches. Moreover, they offer significantly lower computational costs - often by two to three orders of magnitude - making them highly efficient for real-time forecasting.
We provide an open-source implementation of our algorithm in the Python package ondil. To the best of the authors' knowledge, this package is the first native Python implementation of IRLS-based distributional regression and can, therefore, provide a basis for future extensions.\footnote{The package pyNM implements GAMLSS for Python as binding to the R library \url{https://github.com/ppsp-team/PyNM}.} We provide the following features:
The code for our implementation is open source {\color{black} on GitHub} and the package is available at the Python Package Index.\footnote{See: \url{https://pypi.org/project/ondil} and \url{https://github.com/simon-hirsch/ondil}.} {\color{black} All studies in this paper have been run using ondil version 0.3.2.}
{\color{black} This paper presents an efficient, scalable approach to distributional regression by the implementation of an online estimation algorithm} for the well-known, parametric GAMLSS rigby2005generalized, klein2024distributional. {\color{black} We discuss regularized estimation using ridge, LASSO, and the elastic net, and the associated issue of online model selection. Furthermore, we formally analyze the approximation quality of online estimation and batch estimation.} Lastly, we provide an open-source Python implementation in the ondil package. We validate our approach in a forecasting study for the German day-ahead electricity prices, a highly volatile data set. The online distributional regression delivers competitive forecasting accuracy in the CRPS compared to repeated batch estimation and other distributional forecasting approaches while reducing the computation time by some 2-3 orders of magnitude. Furthermore, we provide simulation results on the impact of the initial training size and the exponential discounting on the approximation quality of the online models compared to repeated batch fitting. Our simulation results are in line with the aforementioned theoretical results.
Our research opens up multiple avenues for future research. First, while our empirical results are promising, further theoretical results on the error bounds of the online algorithm would further increase the trust in the proposed method. Secondly, we present a regularized method for the online estimation, but the (online) model selection in distributional regression is a relatively untapped field, and advances here will directly benefit practical applications. {\color{black} While our approach is capable of the estimation of non-linear models using linear basis functions, the implementation of regularized splines and other additive effects is a practically relevant addition. Lastly, online learning for distributional models is naturally confronted with issues of identifiability, and our approach is no exception. We note that regularization plays a critical role in controlling the issue in a practical study; a rigorous formal analysis seems like a promising avenue for further research, benefiting all research on online distributional models.}