Quantile Non-parametric Additive Models

Quantile regression allows us to assess different possible impacts of covariates on different quantiles of a response variable. Additive models for quantile functions provide an attractive frame‐ work for non‐parametric regression applications focused on functions of the response instead of its central tendency. Total variation smoothing penalties can be used to control the smoothness of ad‐ ditive components. We write down a general approach to estimation and inference for additive mod‐ els of this type. Quantile regression as a risk measure has been applied in sector portfolio analysis for a data set from the Warsaw Stock Exchange.


Introduction
Methods of supervised learning -generalised additive model (GAM) methods -are one of the most comprehensive procedures for nonparametric regression models. The idea is based on greater flexibility than traditional parametric modelling methods such as linear models or generalised linear models.
Models with additive nonparametric effects offer a valuable dimension reduction device throughout applied statistics. In this paper, we describe estimation methods for additive quantile regression models. The methods employ the total variation smoothing penalties introduced by Koenker (Koenker, Ng, Portnoy, 1994) for univariate components and next for bivariate components (Koenker, Mizera, 2004). These methods focus on selection of smoothing parameters including lasso-type selection of parametric components, and post-selection inference methods, particularly confidence bands for nonparametric components of the model.
The main goal of this paper is an application of the quantile regression additive model as a risk measure in sector portfolio analysis of data from the Warsaw Stock Exchange. The evaluation of empirical results is conducted to determine the existing gap between the subadditivity and robustness of risk measurement procedures.

Generalised Linear Models (GLM)
The linear regression function has the form: where Y i for i = 1, ..., N are random explanatory variables, (x 1i , ..., x ki ) for i = 1, ..., N are observed values of N -observations for k explanatory variables, e i are errors that for i = 1, ..., N are by definition independent random variables with the same distribution with zero mean and constant variance. The estimation using the least squares method determines the estimator of b coefficients, but it does not allow us to carry out significance tests of these coefficients. An additional assumption should be added about the distribution of random errors: e ~ N(0, s 2 I N ), where I N is the N × N identity matrix. The regression model can be equivalently saved in the matrix form. The linear regression model can be given by: where e e ~ N(0, s 2 I N ). (2) Taking into account the fact that the linear function of a random variable with a normal distribution is a random variable with a normal distribution, you can calculate the expected values in equation (2) and save model (2) as: This version of the model is a starting point for further work with the regression model, as it is easier to extend the model to distributions other than a normal distribution. It is worth noting that the expected values of Y are conditioned by the observed values of the explanatory variables, that is, the response variable is modelled with data contained in the known matrix X. Based on equation (3), it can be shown that a linear relationship will measure the expected value Y, E(Y) = μ, and the values of the explanatory variables.
In practice, you can encounter the following problems when choosing a linear model: 1) the relationship between the response variable and explanatory variables is not linear, 2) random variables e i , and consequently the response variable, have no normal distribution, 3) random variables e i are not independent, 4) variance e i (i.e. the variance of the explanatory variable) is not constant for all observations. Generalised linear models (GLM) and generalised additive models (GAM) are a partial solution to the first and second problem (Lindsey, 1997).
The equation (3) of the linear model can be extended to generalised linear models (GLM). In the generalised linear model in formula (3), the normal distribution of the variable Y i is replaced by the exponential family of distributions. In addition, a monotonic link function g(×) is introduced describing the relationship of the expected value of the response variable Y i designated μ i with the linear predictor h i being a linear combination of explanatory variables: In the vector form, the above-presented record takes the form:

Generalised Additive Models (GAM)
Traditional linear models and generalised linear models in many situations turn out to be an insufficient tool, as in situations describing reality many phenomena have a more complex character. An alternative for linear models and GLM mod-els will be presented -generalised additive models (GAM). GAM models were developed in 1986 by Trevor Hastie and Rob Tibshirani. They proposed estimations for a multidimensional set of variables by means of additive approximation of the regression function, replacing the linear functions of explanatory variables with additive "non-parametric" functions which can be estimated by smoothed cubic spline functions. In terms of regression, GAM have the following form: where a is a constant influence effect, f j , j = 1, 2, ..., k are unknown functions of the j-th explaining variable estimated, among others, using locally polynomial 1 or smoothed cubic spline functions 1 . The estimation of the function f j takes place jointly for j = 1, ..., k using a certain iterative procedure -the back fitting algorithm.
In GAM models, the mean of the response variable Y, conditioned by the explanatory variables, μ = E (Y|X), is modelled using the additive functions f j , j = 1, 2, ..., k of explanatory variables. Similarly to GLM, we can specify g functions which will link μ with additive functions of explanatory variables: Well-known examples of link functions include: 1) g(μ) = μ is the identity link function used in linear and additive models for a Gaussian result variable; 2) g(μ) = logit(μ) for models with the binary variable Y; 3) g(μ) = probit(μ) for models with the binomial probability distribution of the variable Y; probit is an inverse function to a Gaussian distribution: probit(μ) = f −1 (μ); 4) g(μ) = log(μ) for log-linear or log-additive models, for models with the Poisson distribution of the variable Y. The above-presented distributions belong to the exponential distribution family. In GAM models, similarly to GLM, the variable Y belongs to the exponential distribution family. In order to simplify the algorithm scheme, we can assume that the response variable under consideration has a Gaussian distribution and the g(×). The function is an identical link function. Additionally, as the estimation method, we choose smoothed cubic spline functions. 1 The matching function for smooth cubic spline functions in the R programme corresponds to the function smooth.splines (splines).
Quantile Non-parametric Additive Models 131 www.czasopisma.uni.lodz.pl/foe/ FOE 6(345) 2019 Taking into account the above-presented assumptions, the additive model has the following form: where e i is a random error with an average of 0.

Additive Models for Quantile Regression (AMQR)
Models with additive nonparametric effects offer a valuable dimension reduction device throughout applied statistics. Additive models have been introduced by Breiman and Friedman (1985) and Hastie and Tibshirani (1986;1990). They provide a pragmatic approach to nonparametric regression modelling; by restricting nonparametric components so that they are composed of low-dimensional additive pieces, we can omit some of the worst aspects of the notorious curse of dimensionality. Additive models for quantile regression, and especially our implementation of methods in R, have been heavily influenced by Wood (2006;2010).
In some fundamental respects, the approaches are quite distinct: 1) Gaussian likelihood is replaced by (Laplacean) quantile fidelity, 2) L 2 norms used as measures of the roughness of fitted functions are replaced by corresponding L 1 norms measuring total variation, 3) truncated basis expansions are supplanted by sparse algebra as a computational expedient. In many other respects, however, the structure of the models is quite similar to the conditional mean model. We write down models for conditional quantiles indexed by t ∈ (0; 1) in the general form: The nonparametric components g j will be assumed to be continuous functions, either univariate, R → R; or bivariate, R 2 → R. We will denote the vector of these functions as g = (g 1 , …, g J ). The task is to estimate these functions together with the Euclidean parameter q 0 , by solving: where qt(u) = u(t -I(u < 0) is the usual quantile objective function, 0 1 denotes the total variation of the derivative or gradient of the function g. Solutions to this variational problem are piecewise linear functions with knots at the observed z i in the univariate case and piecewise linear functions on a triangulation of the observed z i in the bivariate case. It can be written as a linear programme with (typically) a very sparse constraint matrix consisting mostly of zeros. This sparsity greatly facilitates an efficient solution of the resulting problem, as described in Koenker and Ng (2005). Such problems are efficiently solved by modern interior point methods for linear programming. Back fitting is not required.
For use in practice, additive quantile regression methods must have several properties: 1) the range of model structures available for modelling quantiles must be comparable to that available for modelling the mean in conventional GAMs, otherwise the benefits of modelling quantiles may be offset by the disbenefits of insufficient model flexibility; 2) smoothing parameters must be estimated automatically, otherwise the modelling process becomes too labour intensive and subjective for widespread operational use; 3) uncertainty estimation has to be part of model estimation, since knowing forecast uncertainty is essential for operational use, and 4) methods must be sufficiently numerically efficient and robust for routine deployment. Therefore, in the application part, we use the version of the algorithm 2 based on using smooth relationships between regressors and the quantile of interest using spline basis expansions, and we impose Gaussian smoothing priors to control model complexity. Random effects and parametric terms are not an additional complication (Wood, 2017). This algorithm performs the computations required for belief updating of priors using the loss and to estimate smoothing parameters using the general smooth modelling methods of Wood, Pya and Säfken (2016).

Application of AMQR in sector portfolio analysis
The WIG Food Index is a sector index listed on the Warsaw Stock Exchange, containing companies that participate in the WIG Index. Sector portfolio analysis was dedicated to the food sector. The base date for the WIG Food Index was set as 31 st December, 1998. The sub index is characterised by the same methodology 2 https://mfasiolo.github.io/qgam/articles/qgam.html (accessed: 5.11.2018).
as the main WIG Index. This means that it is an income index, and when calculating it, you should take into account the prices of the shares it contains as well as the right to collect and the income from dividends. The WIG-Food Index consists of 23 companies, of which 15 were selected for analysis, which brings together 86.37% of the total shares in the portfolio and almost total shares in the market, as their sum amounts to 97.80%. The surveyed period from 18 th February 2016 to 19 th February 2018 consisted of 503 observations of closing prices for each of the companies.
The use of risk measures requires examining the types of rates of return distributions. The consistency of the distribution of rates of return with the hypothetical distribution was checked, which is necessary when using quantile risk measures. For this purpose, the Kolmogorov-Smirnov test was used, with the help of which the hypothesis on the compatibility of the distributions of rates of return with both normal and lognormal distributions was verified. In each case, the significance of the test is less than the assumed level of significance of 0.05. This means that the distributions of the rates of return are consistent with a normal or lognormal distribution. Next the parameters of rate of return distribution for each of the companies were calculated (Table 2), especially the third central moment, which is a measure of the asymmetry of empirical rates of return. The optimal portfolio was built, it was assumed that the expected rate of return on the portfolio had to be greater than or equal to 0.001. In addition, it was assumed that the number of companies in the portfolio should be in the range from 5 to 7, and therefore simulations were carried out to choose the optimal solution. Portfolio received the optimal parameters according to the classical portfolio assumption. The following companies were included in the portfolio companies: IMCOMPANY (43.3%), ASTARTA (28%), PEPEES (14.8%), HELIO (0.77%), KSGAGRO (0.61%). Portfolio parameters E(Rp) = 0.001860, V(Rp) = 0.000115, S(Rp) = 0.010713.
As the second step, AMQR was applied for collecting additional information about potential investments. The results of the AMQR estimation are written below (for t = 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9). The formula of the model for conditional quantiles indexed by t ∈ (0; 1) was: Portfolio return = g 1 (ASTARTA) + g 2 (HELIO) + + g 3 (IMCOMPANY) + g 4 (KSGAGRO) + g 5 (PEPEES).         The estimated models have a diversified assessment of the significance of parameters. Additionally, for the chosen value of the quantile, we received different models selected by the estimation process, the equation has a different structure due to the lack of significance of the influence of subsequent explanatory variables. There is also a different assessment of the quality of the models determined using two measures R-sq. (adj) and explained deviance.
The usefulness of these models for the investor in the assessed portfolio is as follows: instead of measuring the portfolio return rate using the weighted average proposed by the classic Markowitz approach, we obtain an assessment of the variability of portfolio return ratios depending on the variability of the distribution of subsequent assets at the level of the determined level of the quantile. Presented portfolio results (Tables 2-10) inform the investor about the significantly greater variability of the extreme values of the rate of return (the tails of the portfolio distribution: q = 0.1, q = 0.2 and q = 0.8 and q = 0.9).
The level of risk aversion is always related to the equity of the investor as well as the capital invested in a given portfolio. The investor assesses the course of variability of the multidimensional distribution, obtaining information from the model for the set of different quantiles.
A very important element of the portfolio risk measurement is compliance with capital market requirements and the level of eventual capital collateral in the event of loss. Such assessments are related to the risk measure (VaR and CVaR) defined in the connection with the set of quantiles. Therefore, to be able to determine these measures, AMQR was applied for high (tail) quantile values. For the presented portfolio, results are shown in Tables 11-13.  There is an assessment of the quality of the models determined using two measures R-sq. (adj) and explained deviance. For the investor, this is information about high volatility derived from the tail of rate of return distribution of the portfolio, especially from assets significant in AMQR.
We based the presented application of AMQR in the analysed portfolios on a selected sector. The portfolios from the selected sector were analysed and the variability of the distribution of the rates of return in the audited period was not particularly significant. In the surveyed sector, all returns of the rate of return were characterised by a significant asymmetry, which means volatility in the tail of the returns. These properties can have a strong impact on the final results.

Conclusions
In this paper, we work with additive regression models. Additive models for quantile functions provide an attractive framework for non-parametric regression applications focused on functions of the response instead of its central tendency. Quantile regression provides a workable method for estimating effects of explanatory variables on different conditional quantiles of an outcome variable. In the application part, we focus on portfolio analysis based on the WIG Food Index, which is a sector index listed on the Warsaw Stock Exchange containing companies that participate in the WIG Index. Based on results of AMQR estimation, we claim usefulness of AMQR as a risk measure.