Variable Importance in Generalized Linear Models – A Unifying View Using Shapley Values Sinan Acemoglu, Christian Kleiber, Jörg Urban Abstract Variable importance in regression analyses is of considerable interest in a variety of fields. There is no unique method for assessing variable importance. However, a substantial share of the available literature employs Shapley values, either explicitly or implicitly, to decompose a suitable goodness-of-fit measure, in the linear regression model typically the classical R 2 R^{2} . Beyond linear regression, there is no generally accepted goodness-of-fit measure, only a variety of pseudo- R 2 R^{2} s. We formulate and discuss the desirable properties of goodness-of-fit measures that enable Shapley values to be interpreted in terms of relative, and even absolute, importance. We suggest to use a pseudo- R 2 R^{2} based on the Kullback-Leibler divergence, the Kullback-Leibler R 2 R^{2} , which has a convenient form for generalized linear models and permits to unify and extend previous work on variable importance for linear and nonlinear models. Several examples are presented, using data from public health and insurance. Keywords. Averaging over orderings; Dominance analysis; Goodness of fit; Hierarchical partitioning; Kullback-Leibler divergence; Regression 1 Introduction Assessing the importance of explanatory variables in regression analyses is of considerable interest in a number of areas. There is a large literature spanning several decades, highly fragmented and characterized by parallel developments and rediscoveries in numerous fields, among them various behavioral and social sciences, the medical sciences, ecology, and business administration. Excellent surveys are available from 1 , 18 , and 15 ; 16 . For the linear regression model, a prominent method, apparently originating from 26 , determines variable importance via a representation of the classical R^{2} as a weighted average involving all possible subsets of regressors in the model. At the time it did not attract much attention, presumably because of the substantial computational burden. (Note that a model with 10 regressors – a model of rather modest size by current standards – already involves 2^{10}=1024 regressions.) The beauty of the proposal in 26 is that it is easy to interpret and that it produces a ‘fair’ decomposition of the value of an overall goodness-of-fit measure, R^{2} , into the contributions of the individual regressors. The method has been rediscovered and extended several times using different terminologies, among them averaging over orderings ( 21 ; 22 , a term that we will use below, see) , hierarchical partitioning ( 9 ) and dominance analysis ( 4 ; 2 ) . More specifically, hierarchical partitioning and dominance analysis extend the idea of 26 by permitting fairly arbitrary goodness-of-fit measures for evaluating the contributions of predictors. They also go beyond linear regression. It was pointed out by 39 that hierarchical partitioning, and hence averaging over orderings, amounts to using the Shapley value, a concept from cooperative game theory, to decompose a measure of fit of the regression. An early paper explicitly using the Shapley value framework is 27 , still confined to linear regression. Advances in statistical computing and increasing computational power have made Shapley value computations more feasible in recent years, and the availability of flexible software for nonlinear models has motivated the search for measures of variable importance beyond linear regression. Indeed, 9 already suggested to use hierarchical partitioning to measure the contributions of predictors in classical nonlinear models via a decomposition of \chi^{2} statistics. Later, 3 applied dominance analysis in logistic regression, but now with certain pseudo- R^{2} measures. To the best of our knowledge, empirical examples for nonlinear models are still largely confined to binary response models, although some software implementations offer functionality beyond this setting, notably Poisson regression. However, there are problems with certain proposals and corresponding implementations, as we shall discuss below. In this paper, we pursue three goals: (i) the formulation of desirable properties of goodness-of-fit measures that allow an interpretation of Shapley values in terms of relative and even absolute importance, (ii) the systematic use of Shapley values for a reasonably large class of models, here GLMs and certain extensions thereof, and (iii) the consistent use of Shapley values with goodness-of-fit measures that generalize classical variants while at the same time opening the methodology to further settings. We show that the goodness-of-fit measures that are used to assess the contributions of predictors need to be chosen carefully, as their properties are critical to the interpretation of the resulting Shapley values. We therefore formulate desirable properties of goodness-of-fit measures that help to interpret the resulting Shapley values as measures of relative and even of absolute importance. Currently, there does not appear to be a generally accepted procedure for assessing variable importance in generalized linear models (GLMs). Therefore, we propose to use Shapley values along with a fit measure that meets certain requirements and exists for all GLMs, namely the Kullback-Leibler R^{2} , hereafter denoted as R^{2}_{\text{KL}} . It was introduced by 8 and is closely related to the deviance and the classical likelihood ratio statistic. Specifically, for the linear regression model R^{2}_{\text{KL}} reduces to the classical R^{2} , while for binary response models it reduces to McFadden’s likelihood ratio index, perhaps the most prominent of all pseudo- R^{2} measures in this setting. Thus, our proposal extends Shapley value decompositions from linear regression models to the much larger class of GLMs (and even some related models), thereby providing a unified approach to variable importance for a range of nonlinear regression models. We present several empirical examples to illustrate the methodology, using data from public health and insurance. The remainder of this paper is organized as follows: In Section 2 we summarize the necessary background on the Shapley value. In Section 3 we discuss desirable properties of a goodness-of-fit measure for which Shapley values are computed. We establish that R^{2}_{\text{KL}} possesses these properties in Section 4 . Section 5 provides examples involving Poisson and geometric regression as well as the Poisson hurdle model, a model with two linear predictors but with GLM building blocks. These examples also illustrate the tradeoffs in the choice of the fit measure. Section 6 concludes. 2 Shapley values in regression The Shapley value is a solution concept from cooperative game theory, introduced by 36 . A convenient reference for the game-theoretical terminology and background is 13 . A cooperative game (P,v) in coalitional form is described by a finite set of players, P=\{1,\dots,p\} , and a characteristic function v:2^{P}\to\mathbb{R} that assigns a real number v(S) to each element S of the power set 2^{P} . S\subseteq P is called a coalition, P the grand coalition, and v(S) can be interpreted as the payoff that coalition S can secure when its members act as a unit. In cooperative game theory, a standard condition for the characteristic function v is v(\varnothing)=0 ; i.e., the empty set or coalition \varnothing secures a payoff of zero. We may refer to this as ‘zero-normalization’. The Shapley value \varphi_{i}(P,v) for player i\in P and a given characteristic function v is \varphi_{i}(P,v)\penalty\ =\penalty\ \sum_{S\subseteq P\setminus\{i\}}\underbrace{\frac{|S|!\penalty\ (p-|S|-1)!}{p!}}_{\rm{weight}}\underbrace{\left(v(S\cup\{i\})-v(S)\right)}_{\text{\parbox{113.81102pt}{\centering marginal contribution of\\ player $i$ to coalition $S$\@add@centering}}}, (1) where |S| represents the cardinality of the set S . Hence \varphi_{i}(P,v) is the average marginal contribution of player i ; the average is formed over all subsets S of P that do not contain player i . Following 22 , one may call this approach averaging over orderings . Among the various properties of the Shapley value, the efficiency property ( 36 ) \sum_{i\in P}\varphi_{i}(P,v)\penalty\ =\penalty\ v(P) (2) is of particular importance for this paper. It states that the value of the characteristic function evaluated at the entire set of players, the grand coalition P , is identical to the sum of all Shapley values. Shapley values in linear regression As noted above, Shapley values emerged implicitly in the variable importance literature via the principle of averaging over orderings. In a regression context, the set of ‘players’ is a set P=\{1,2,\dots,p\} of regressors that is used to predict a particular outcome. It leads to 2^{p} different models defined by the different subsets of regressors that can be formed. The role of the characteristic function v is played by a suitable goodness-of-fit measure. In the linear regression model typically the classical R^{2} is used, which satisfies v(\varnothing)=0 . In view of the efficiency property ( 2 ), each Shapley value \varphi_{i}(P,v) can be interpreted as the contribution of regressor i to the model’s overall R^{2} , hence in this sense it measures the regressor’s relative importance. 26 suggest a measure of importance based on semi-partial correlations r_{(i\cdot S)}^{2} . These semi-partial correlations r_{(i\cdot S)}^{2} measure the correlation between the response y and the regressor i , with the correlations of the other predictors in S\subseteq P partialed out. The measure can be expressed as a weighted average over the increments in R^{2} resulting from the inclusion of predictor i , specifically, with v=R^{2} \displaystyle\varphi_{i}(P,R^{2}) \displaystyle= \displaystyle\sum_{S\subseteq P\setminus\{i\}}\frac{|S|!\penalty\ (p-|S|-1)!}{p!}\,r_{(i\cdot S)}^{2} (3) \displaystyle= \displaystyle\sum_{S\subseteq P\setminus\{i\}}\frac{|S|!\penalty\ (p-|S|-1)!}{p!}\,\left(R^{2}(S\cup\{i\})-R^{2}(S)\right). Here R^{2}(S) and R^{2}(S\cup\{i\}) correspond to the R^{2} s of the models whose sets of predictors are S and S\cup\{i\} , respectively. Thus 26 have implicitly proposed the use of Shapley values in regression. Applications to linear regressions abound; 15 ; 16 provides many references. Shapley values beyond linear regression 9 already suggested to use Shapley values beyond the linear regression model, explicitly mentioning logistic, probit, and log-linear regression. Within the framework of hierarchical partitioning, 42 calculated Shapley values for the logit model using the log-likelihood as the characteristic function. Within the framework of dominance analysis, 3 provide a further application to binary response models. To overcome rescaling issues inherent in the use of the likelihood, they suggest the use of certain pseudo- R^{2} measures to calculate Shapley values. Among these pseudo- R^{2} measures, they express a slight preference for the likelihood ratio index of 32 , hereafter denoted as R^{2}_{\text{McF}} . More recent applications include 44 and 24 . 34 apply dominance analysis to Poisson regression using R^{2}_{\text{McF}} , and 40 also evaluate variable importance for the Poisson model through Shapley values. Applications of dominance analysis even beyond GLMs exist, see 37 for an example using beta regression. Noting that pseudo- R^{2} measures such as McFadden’s likelihood ratio index R^{2}_{\text{McF}} , originally designed for binary data, may not be appropriate in their setting (which involves a continuous distribution), they use characteristic functions such as the BIC and the likelihood ratio test statistic. Furthermore, an application involving two-part models, also known as hurdle models, is sketched in 25 . Their two-part model consists of two GLM building blocks, a logit model and a gamma regression model. We also provide an example of a two-part model in Section 5.2 below, where we consider the widely used Poisson hurdle model. 37 emphasize that the choice of the goodness-of-fit measure is important in nonlinear settings. Indeed, in Section 3 we show that a careful choice of the fit measure is essential for the validity of the efficiency property ( 2 ), and, consequently, for the interpretation of the resulting Shapley values and the unification of the associated methodology. We observe that there are numerous potential choices for the characteristic function v . For example, the machine learning (ML) literature has recently shown a trend towards ‘explainable’ or ‘interpretable’ ML, in which Shapley values are employed to decompose predictions or prediction errors. Influential papers in this area include 38 and 28 , which contain references to earlier work in computer science and related fields. In a predictive setting where v represents a conditional expectation, neither v(\varnothing)=0 nor monotonicity with respect to the addition of further predictors is generally satisfied. Therefore, the resulting Shapley-based decomposition does not represent a decomposition of a fit measure. In contrast, in line with earlier developments in the statistical literature, we focus on decomposing a goodness-of-fit measure. This requires a characteristic function with certain monotonicity properties. More on this in Section 3 . Software Dominance analysis and hierarchical partitioning have been implemented in several R packages, permitting to decompose quantities such as the log-likelihood or the pseudo- R^{2} measures used by 3 . The hierarchical partitioning procedure is available from the hier.part package ( 29 ) and dominance analysis from the package dominanceanalysis ( 35 ) . For linear models, the package relaimpo ( 14 ) also provides methods that are not derived from the principle of averaging over orderings. 3 The role of the goodness-of-fit measure In applications, it is desirable that measures of variable importance are easy to interpret. In this section, we show that under certain conditions this goal can be achieved when using Shapley values. We next discuss desirable properties of the goodness-of-fit measure (the characteristic function in the original game-theoretical context). 3.1 Monotonicity From a regression point of view, it is natural to require a characteristic function that is weakly increasing when a new predictor is added, i.e., v(S\cup\{i\})\geq v(S) for any S\subseteq P and i\in P\setminus S . This is a meaningful condition because we expect a goodness-of-fit measure to improve, or at least to remain unchanged, when a new explanatory variable is added. In view of ( 1 ), the resulting Shapley values are nonnegative under this condition. 3.2 Lower bound 36 requires a characteristic function to satisfy v(\varnothing)=0 from Section 2 . In a regression context, this condition means that the fit of the model not using any regressors (beyond a constant term) is zero. The condition v(\varnothing)=0 along with monotonicity also results in v(S)\geq 0 for all S\subseteq P . We call this the lower bound condition. In our context, the set of Shapley values \varphi_{i}(P,v) represents a decomposition of the fit measure evaluated at the full set of regressors, \sum_{i\in P}\varphi_{i}(P,v)=v(P) . Hence the (normalized) Shapley values can be interpreted as shares relative to the fitted model, FM ; i.e., we can define an importance measure for variable i by setting \displaystyle impFM_{i}\penalty\ :=\penalty\ \dfrac{\varphi_{i}(P,v)}{\sum_{j\in P}\varphi_{j}(P,v)}\penalty\ =\penalty\ \dfrac{\varphi_{i}(P,v)}{v(P)},\qquad{\rm with}\;\sum_{i=1}^{p}impFM_{i}\penalty\ =\penalty\ 1. (4) For later use, we briefly explore the implications for interpretability when the zero-normalization condition for the characteristic function is not satisfied. Specifically, consider a ‘pseudo-characteristic function’ v^{*} with v^{*}(\varnothing)\neq 0 and denote the resulting ‘pseudo-Shapley values’ by \varphi^{*}_{i} . Next, define v by v(\cdot)=v^{*}(\cdot)-v^{*}(\varnothing) , which represents a zero-normalized characteristic function. Starting from equation ( 1 ), we see that, by construction, \varphi^{*}_{i}(P,v^{*})\penalty\ =\penalty\ \varphi_{i}(P,v), (5) because the building blocks of Shapley values are differences of v^{*} for ‘pseudo-Shapley values’ and differences of v for Shapley values. Therefore, we can also use the ‘pseudo-Shapley values’ to establish a ranking of the predictors. Specifically, if \varphi^{*}_{A}>\varphi^{*}_{B} , then predictor A is more important than predictor B within the fitted model. Furthermore, using equation ( 5 ) and the efficiency property, we have \sum_{i}\varphi^{*}_{i}(P,v^{*})\penalty\ =\penalty\ \sum_{i}\varphi_{i}(P,v)\penalty\ =\penalty\ v(P)\penalty\ =\penalty\ v^{*}(P)-v^{*}(\varnothing)\penalty\ \neq\penalty\ v^{*}(P). (6) Thus, a violation of the zero-normalization condition for the characteristic function has the implication that the implied pseudo-Shapley values do not correspond to the predictors’ contributions to the overall v^{*}(P) of the fitted model because the efficiency property does not hold for \varphi^{*}_{i}(P,v^{*}) . Indeed, the resulting pseudo-Shapley values sum up to v(P) and should therefore be interpreted with respect to v(P) and not v^{*}(P) . Furthermore, the quantities impFM_{i} based on pseudo-Shapley values do not correspond to the relative contribution of the overall explanatory power v^{*}(P) of the fitted model; i.e., they do not add up to 1. This is a consequence of the shift term v^{*}(\varnothing) in equation ( 6 ). It follows that for interpretational purposes pseudo-Shapley values are of limited usefulness and should only be used for ordinal comparisons of predictors. We will return to this issue in Section 5 , where we will illustrate problems arising from the use of a prominent example of a pseudo-characteristic function, the log-likelihood function \ell . The log-likelihood \ell generally does not satisfy the zero-normalization condition, so it will lead to pseudo-Shapley values instead of genuine Shapley values, which raises various interpretational issues. 3.3 Upper bound Recall that the empty set corresponds to a model with no regressors and thus describes the ‘worst’ model. Analogously, the ‘best’ model could be defined in a data driven manner, where each observation is given its own regression coefficient. This is called the saturated model in a GLM setting (e.g. 11 , p. 274) and corresponds to the model for which the likelihood is maximized for a given set of data and a given type of model ( 31 , p. 33) . Therefore, it represents a further suitable reference point in our context. Just as in the case of the ‘worst benchmark model’ discussed above, problems of interpretation can also arise when a goodness-of-fit measure v is used that cannot be interpreted relative to some ‘best benchmark model’. More formally, suppose v:S\rightarrow[0,b] , b\in\mathbb{R}_{+} 1 1 1 Due to the monotonicity and the zero-normalization condition, the range of values of the goodness-of-fit measure v is a subset of \mathbb{R}_{+} . and S\subseteq P^{\prime} . Here P^{\prime} represents the saturated model. Then, v(\varnothing)=0 and v(P^{\prime})=b represent the evaluations of the ‘worst’ and ‘best’ models, respectively. In the original 36 setting, there is no upper bound on the range of values of the characteristic function. However, in a regression context the overall fit v(P) is difficult to interpret in the absence of an upper bound. This is mainly due to the fact that the value b of the goodness-of-fit measure of the ‘best’ baseline model may be unknown or unavailable (e.g., in the case of the log-likelihood function \ell ). Here, we can still use \varphi_{i}(P,v) to assess relative importance similar to Subsections 3.1 and 3.2 . However, the implications for interpretability remain, because a seemingly large Shapley value \varphi_{i}(P,v) may indicate great importance while the overall fit of the model may be poor. The poor fit would not be recognized unless b is known. In other words, a large Shapley value could still correspond to a predictor of limited relevance. This problem can be overcome if the fit of the ‘best benchmark model’ is known. Then, the Shapley value can be interpreted as the importance relative to the best model, BM , \displaystyle impBM_{i}\penalty\ :=\penalty\ \dfrac{\varphi_{i}(P,v)}{b}. (7) If we additionally have a characteristic function for which the finite upper bound is equal to unity, i.e., b=1 , the Shapley values can now even be interpreted as absolute importance measures relative to the best model achievable. Furthermore, a comparison is now possible for all models that are estimated using the same model class and data. To avoid the problems discussed above, we therefore suggest using a goodness-of-fit measure with an upper bound of one. 3.4 Structural interpretability of the fit measure So far, we have discussed conditions that ensure a straightforward interpretation of Shapley values as importance measures, leading to the ability to rank regressors and to assess whether their contributions are large relative to the fitted model or to some ‘best’ model. However, in addition to the points made in previous subsections, the interpretation of the resulting Shapley values depends highly on the structure of the fit measure itself. For example, the classical R^{2} in the linear regression model corresponds to the fraction of the overall variance that is explained by the model. Thus, when using the classical R^{2} in a linear model, the Shapley value for a predictor can be interpreted as the share of the variance that is explained by this predictor ( 26 ) . In contrast, using a likelihood-based quantity as the goodness-of-fit measure, for example, does not usually result in a variance decomposition beyond the linear regression model. Thus, although the conditions from Subsections 3.1 – 3.3 already permit interpretation of Shapley values at a certain level, a suitable choice of the goodness-of-fit measure can lead to additional insights. Therefore, we suggest using a goodness-of-fit measure that has a meaningful structural interpretation for a range of regression models, such as GLMs. A suitable candidate is the Kullback-Leibler R^{2} , whose properties are summarized in Section 4 . 3.5 Desirable properties of the fit measure The previous subsections have provided insights into the importance of the choice of the goodness-of-fit measure as the characteristic function, its structure, interpretability and the implications thereof. In view of the problems mentioned above, the following properties are desirable: (i) Monotonicity: v is (weakly) non-decreasing when a new predictor is added, (ii) Lower bound: v(\cdot)\geq 0 , (iii) Upper bound: v({\text{saturated model}})=1 , (iv) Structural interpretability of v for GLMs. The monotonicity condition (i) ensures that all resulting Shapley values are non-negative and are comparable with each other through relative orderings. In addition, condition (ii) ensures that a Shapley value can be interpreted as contribution to the overall fit v(P) and thus as the importance of the variable relative to the fitted model . Condition (iii) extends this interpretation even to importance relative to the best achievable model , i.e., to absolute importance. Table 1 summarizes these interrelations. Table 1: Connections among the properties of the fit measure and the properties of the corresponding Shapley and pseudo-Shapley values pseudo-Shapley values as Shapley values as Shapley values as relative and relative variable importance XX relative variable importance absolute variable importance nonnegative relative importance relative importance relative Condition: contribution ordering to fitted model impFM to ‘best’ model impBM (i) Monotonicity \times \times \times \times (ii) Lower bound \times \times (iii) Upper bound \times Therefore, if conditions (i)–(iii) are satisfied, the resulting Shapley values can be interpreted in terms of relative and absolute importance. Using condition (iv) in addition to conditions (i)–(iii) also ensures that the Shapley values can be interpreted at a deeper structural level. For example, they can be interpreted as the fraction of the variance explained in linear regression when using R^{2} as the goodness-of-fit measure. Also, conditions (i)–(iii) are meaningful for regression models in general and are not limited to GLMs. Condition (iv) leads to a main focus of this paper, variable importance in GLMs. 4 The Kullback-Leibler R^{2} and its properties In the previous section we emphasized that a careful choice of the goodness-of-fit measure is crucial, as it can avoid misinterpretation of results and also lead to an interpretation of Shapley values at a more structural level. It is assumed that we have a random sample y_{1},\dots,y_{n} from f(y;\theta) , a genuine (uncurved) one-parameter exponential family, with f(y;\theta)=\exp\left\{y\theta-b(\theta)+c(y)\right\},\;\theta\in\Theta, (8) where \theta is the natural or canonical parameter, \Theta an interval of the real line, b the cumulant function, and c a function that does not depend on \theta . Different choices of the cumulant function b lead to different models. In a GLM, the mean \mu of f is monotone in \theta and is parameterized using a linear predictor \eta_{i} and a known smooth and invertible link function g , with g(\mu_{i})=x_{i}^{\top}\beta=\eta_{i} , where x_{i}\in\mathbb{R}^{p} is the vector of the p regressors for observation i and \beta\in\mathbb{R}^{p} is the vector of regression coefficients. Throughout it is assumed that models contain a constant term. Estimation is via maximum likelihood (ML); the maximum likelihood estimator (MLE) \hat{\theta} is in the interior of \Theta . In a GLM setting, a unified approach to variable importance is possible when the Kullback-Leibler R^{2} , denoted as R^{2}_{\text{KL}} , is used as the goodness-of-fit measure. R^{2}_{\text{KL}} was introduced by 8 . A main advantage of R^{2}_{\text{KL}} is that it is meaningful for any regression model based on a (one-parameter) exponential family; see 8 and their Table 1 for an overview. Also, many well known (pseudo-) R^{2} measures are special cases of R^{2}_{\text{KL}} , among them the classical R^{2} for the linear regression model, R^{2}_{\text{McF}} for binary response models, and the deviance R^{2} for Poisson regression ( 7 ) . In addition, R^{2}_{\text{KL}} can be interpreted in terms of the likelihood ratio test statistic (see Section 4.2 ). 4.1 The Kullback-Leibler R^{2} Recall that the Kullback-Leibler divergence ( 23 ) is defined as K(\theta_{1},\theta_{2})\penalty\ :=\penalty\ 2\;\mathsf{E}_{\theta_{1}}\left[\log\left(\dfrac{f(y,\theta_{1})}{f(y,\theta_{2})}\right)\right]. (9) It measures the information discrepancy between two densities, here represented by their parameters \theta_{i} , i=1,2 , using Shannon’s entropy. \mathsf{E}_{\theta_{1}} represents the expectation with respect to the model parameterized by \theta_{1} . For one-parameter exponential families, K(\theta_{1},\theta_{2})\penalty\ =\penalty\ 2\;\left[(\theta_{1}-\theta_{2})\mu_{1}-(b(\theta_{1})-b(\theta_{2}))\right]. (10) Since the mean \mu of f is monotone in \theta , we can write \mu=\mu(\theta) or \theta=\theta(\mu) , and also K(\mu_{1},\mu_{2}) or K(\theta_{1},\theta_{2}) , as is convenient. In a GLM setting, if \theta_{1} represents the saturated model with \mu_{1}=\mathbf{y} , with \mathbf{y} representing the data, we thus have K(\mathbf{y},\mu_{2})\penalty\ =\penalty\ 2\;\left[(\theta(\mathbf{y})-\theta_{2})\mathbf{y}-(b(\theta(\mathbf{y}))-b(\theta_{2}))\right]. Genuine one-parameter exponential families are uncurved or flat ( 41 ) and the Kullback-Leibler divergence satisfies the Pythagorean relation ( 12 ; 17 ) , K(\hat{\mu},\mu)\penalty\ =\penalty\ K(\mathbf{y},\mu)-K(\mathbf{y},\hat{\mu}), where \hat{\mu} represents the fitted model and \mu some other model. For our purposes, \mu=\hat{\mu}_{0} , the model with only a constant term, is of particular interest. The corresponding Kullback-Leibler R^{2} is now given by R^{2}_{\text{KL}}\penalty\ =\penalty\ 1-\dfrac{K(\mathbf{y},\hat{\mu})}{K(\mathbf{y},\hat{\mu}_{0})}\quad\in[0,1]. (11) The idea is that the simplest model containing a constant only – i.e., \hat{\mu}_{0}=\bar{y}\mathbf{1}_{n}\in\mathbb{R}^{n} in the linear model, with \mathbf{1}_{n} an n -vector of ones – yields the maximum deviation from the ‘best’ model, i.e., it maximizes the Kullback-Leibler divergence within a pre-specified model class. If a regressor contributes explanatory power to the model predictions \hat{\mu} and leads to an improvement, we have K(\mathbf{y},\hat{\mu})0,\end{cases} (21) where x_{i1},x_{i2} are the vectors of regressors for observation i and \tau_{1},\tau_{2} are the corresponding vectors of regression coefficients, respectively. In general, x_{i1}\neq x_{i2} , but specifications where x_{i1}=x_{i2} are quite common in the empirical literature. The log-likelihood of the hurdle model, \ell_{\text{hurdle}} , can be split into two components ( 33 ) : the log-likelihood of a binary response model, \ell_{\text{binary}} , and the log-likelihood of a zero-truncated count regression model, \ell_{\text{zt-count}} ; i.e., \ell_{\text{hurdle}}\penalty\ =\penalty\ \ell_{\text{binary}}+\ell_{\text{zt-count}} . This implies that the hurdle model can be estimated by fitting both parts separately, and that variable importance can be assessed part by part. For the binary part, we use a logit model, with y^{*}_{i} an indicator of positive counts, f(y^{*}_{i};x_{i1},\mu_{i1})\penalty\ =\penalty\ \mu_{i1}^{y^{*}_{i}}\,(1-\mu_{i1})^{(1-y^{*}_{i})},\quad\text{for}\penalty\ y^{*}_{i}\in\{0,1\}, (22) where \mu_{i1}=\mathsf{P}(y^{*}_{i}=1\mid x_{i1})=\mathsf{E}(y^{*}_{i}\mid x_{i1}) and \eta_{i}=\log\left(\mu_{i1}/(1-\mu_{i1})\right) . For the positives, we use a zero-truncated Poisson model, with f(y_{i};x_{i2},\mu_{i2})\penalty\ =\penalty\ \dfrac{\mu_{i2}^{y_{i}}}{(e^{\mu_{i2}}-1)\;y_{i}!},\quad\text{for}\penalty\ y_{i}\in\mathbb{N}, (23) where \mu_{i2}=\mathsf{E}(y_{i}\mid x_{i2}) and \eta_{i}=\log(\mu_{i2}) . The zero-truncated Poisson distribution is still an exponential family, hence it naturally leads to a GLM. The two log-likelihood components for our model are thus given by \displaystyle\ell_{\text{logit}}(\mathbf{y}^{*},\mu_{1}) \displaystyle=\sum_{i=1}^{n}\left[y^{*}_{i}\log(\mu_{i1})+(1-y^{*}_{i})\log(1-\mu_{i1})\right], \displaystyle\ell_{\text{ztPoi}}(\mathbf{y},\mu_{2}) \displaystyle=\sum_{\{i:y_{i}>0\}}\left[y_{i}\log(\mu_{i2})-\log\left(e^{\mu_{i2}}-1\right)-\log(y_{i}!)\right]. (24) Overall, equations ( 24 ) imply that the Poisson hurdle model has two GLM building blocks, a logit model for the binary part and a zero-truncated Poisson regression model for positive counts. They also imply that variable importance can be assessed by using the Shapley value approach separately for each of these two building blocks. Figure 2: Rootogram of the Poisson hurdle model using all 13 regressors. We use this Poisson hurdle model to model car insurance data previously analyzed by 43 . Their data are available via the AutoClaim data from the R package cplm ( 45 ) . Specifically, the relevant subset of observations can be extracted via a binary factor, IN_YY , indicating inclusion in the Yip and Yau paper. The response variable of interest is the number of claims in the past five years, cfreq5 , with a maximum count of 5 . Yip and Yau use five regressors in their main analysis, but start out from a larger data set of 13 regressors, which in turn are taken from an even larger data set. Given our interest in variable importance we use their initial set of 13 regressors: age , area , cartype , educ , gender , income , jobclass , married , red , revoked , singlep , usage and violation . 4 4 4 The original names of the variables in the AutoClaim data are, in the same order: AGE, AREA, CAR_TYPE, MAX_EDUC, GENDER, INCOME/10000, JOBCLASS, MARRIED, RED_CAR, REVOLKED, PARENT1, CAR_USE and MVR_PTS. Note that income is INCOME scaled by 10000. The response cfreq5 was originally called CLM_FREQ5. See 43 and the documentation of the AutoClaim data for further information on these predictors. The rootogram in Figure 2 confirms that the claim frequency variable is adequately modelled by a Poisson hurdle model using these predictors. The Kullback-Leibler R^{2} for the zero-truncated Poisson model, R^{2}_{\text{KL,ztPoi}} , is given by \displaystyle R^{2}_{\text{KL, ztPoi}} \displaystyle=1-\dfrac{\sum_{\{i:y_{i}>0\}}\big[y_{i}\log(y_{i}/\hat{\mu}_{i})-\log(\exp(y_{i})-1)+\log(\exp(\hat{\mu}_{i})-1)\big]}{\sum_{\{i:y_{i}>0\}}\big[y_{i}\log(y_{i}/\bar{y}_{+})-\log(\exp(y_{i})-1)+\log(\exp(\bar{y}_{+})-1)\big]}, (25) where \bar{y}_{+}=n_{+}^{-1}\sum_{\{i:y_{i}>0\}}y_{i} , with n_{+} corresponding to the number of positive responses ( y_{i}>0 ). For the binary part with a logit link we have ( 8 ) \displaystyle R^{2}_{\text{KL, logit}}=1-\dfrac{\sum_{i=1}^{n}\big[y^{*}_{i}\log(\hat{\mu}_{i})+(1-y^{*}_{i})\log(1-\hat{\mu}_{i})\big]}{\sum_{i=1}^{n}\big[y^{*}_{i}\log(\bar{y}^{*})+(1-y^{*}_{i})\log(1-\bar{y}^{*})\big]}. (26) As noted above, the resulting Kullback-Leibler R^{2} for the binary part is identical to R^{2}_{\text{McF}} . Table 3: Largest five Shapley- and pseudo-Shapley values for the positive part of the hurdle model, using v=R^{2}_{\text{KL}} , v=\ell-\ell(\varnothing) and v^{*}=\ell , respectively. cartype jobclass red educ singlep v(P) or v^{*}(P) v=R^{2}_{\text{KL}} 0.0103 0.0067 0.0045 0.0036 0.0036 0.0340 v=\ell-\ell(\varnothing) 2.9199 1.9136 1.2756 1.0252 1.0212 9.6376 v^{*}=\ell 2.9199 1.9136 1.2756 1.0252 1.0212 -1453.3342 Table 3 provides the five largest Shapley values for the positive part of the hurdle model using all 13 variables, along with the resulting goodness-of-fit measures R^{2}_{\text{KL}} , the log-likelihood, and the shifted log-likelihood. (The choice of fit measures is motivated by their availability in software implementations, specifically in the R packages hier.part and dominanceanalysis .) The table nicely illustrates the problems arising from the violation of the lower and upper bound conditions, as discussed in Sections 3.2 and 3.3 . First, the pseudo-Shapley values associated with the log-likelihood (bottom row in Table 3 ) might suggest some relevance of the variables, although the overall fit in terms of R^{2}_{\text{KL}} is quite poor, as only about 3.4\% of the empirical uncertainty is explained by the model. The value of the corresponding overall log-likelihood v^{*}(P)=-1453.33 does not provide much useful information here, it is negative and difficult to interpret. Second, the efficiency condition is satisfied for the shifted log-likelihood v=\ell-\ell(\varnothing) , and the corresponding overall value v(P)=9.64 might suggest a good model (recall that a value of zero corresponds to the worst model). However, there is still a lack of interpretability, as the fit of the best model is not known or computed. The missing reference point of the best model does not allow to assess whether v(P)=9.64 is ‘small’ or ‘large’. This problem does not arise with a fit measure that satisfies the upper and lower bound conditions, such as R^{2}_{\text{KL}} , where the value v(P)=0.034 can be compared against the built-in upper bound of 1. Using R^{2}_{\text{KL}} , the Shapley values allow, in addition to an interpretation in terms of relative importance, an interpretation in terms of absolute importance. For example, cartype is about 1.54 times more important than jobclass , while in absolute terms both predictors are not important. Table 4: Largest five Shapley- and pseudo-Shapley values for the binary part of the hurdle model, using v=R^{2}_{\text{KL}} , v=\ell-\ell(\varnothing) and v^{*}=\ell , respectively. violation area cartype jobclass educ v(P) or v^{*}(P) v=R^{2}_{\text{KL}} 0.1612 0.0580 0.0038 0.0034 0.0024 0.2353 v=\ell-\ell(\varnothing) 303.7332 109.3837 7.1795 6.4305 4.4890 443.5264 v^{*}=\ell 303.7332 109.3837 7.1795 6.4305 4.4890 -1441.0973 The results for the binary part are summarized in Table 4 . As before, the violations of the lower and upper bound conditions lead to problems of interpretation. For v^{*}=\ell , an ordering of the predictors in terms of relative importance is possible, but statements about the importance relative to the fitted ( impFM ) and ‘best’ ( impBM ) models are impossible without knowing \ell(\varnothing) . For v=\ell-\ell(\varnothing) , statements about impFM become feasible. The Shapley values for violation and area are the largest – these regressors explain 68.5% and 24.7% of the fitted model, respectively –, while the other predictors appear to be much less relevant. Using v=R^{2}_{\text{KL}} provides further insight, as the Shapley values can now be interpreted as absolute importance measures. The predictors violation and area explain 16.12% and 5.80% , respectively, relative to the best model. A comparison of Tables 3 and 4 reveals another interesting detail: the binary response model explains 23.53\% of the empirical uncertainty, whereas the zero-truncated Poisson model in Table 3 explains only 3.40\% . Therefore, the binary part of this two-part model performs much better than the zero-truncated Poisson part. In practical terms, this means that while the available regressors are useful for modelling claim incidence, they are of limited relevance for modelling the exact number of claims. Furthermore, since R^{2}_{\text{KL}} is a likelihood-based goodness-of-fit measure, the ‘distortions’ of the (pseudo-) Shapley values resulting from the use of v=\ell-\ell(\varnothing) and v^{*}=\ell can be quantified. All three goodness-of-fit measures are linearly related, in particular it can be shown (see Appendix A ) that \displaystyle\varphi_{i}(P,R^{2}_{\text{KL}})\penalty\ =\penalty\ \underbrace{\dfrac{1}{\ell(\mathbf{y},\mathbf{y})-\ell(\mathbf{y},\hat{\mu}_{0})}}_{=:C}\,\varphi^{*}_{i}(P,\ell)\penalty\ =\penalty\ \underbrace{\dfrac{1}{\ell(\mathbf{y},\mathbf{y})-\ell(\mathbf{y},\hat{\mu}_{0})}}_{=:C}\,\varphi_{i}(P,\ell-\ell(\varnothing)), (27) where C is the null deviance. In other words, the resulting (pseudo-) Shapley values inherit the linear relationship that exists between the fit measures. For the data at hand, we have C^{-1}=283.75 for the zero-truncated Poisson model and C^{-1}=1884.62 for the logit model, respectively. 5 5 5 The values of C calculated from Tables 3 and 4 differ slightly due to rounding. 5.3 Geometric regression Figure 3: Rootogram of the geometric regression model using all regressors. Another typical problem with count data is overdispersion, i.e., the presence of more variability in a data set than would be expected based on a given model for the mean (the implicit reference point being the Poisson model). Our final example, therefore, presents a count data model that allows for a substantial amount of overdispersion. Again, we use data from health economics, originally analyzed by 10 , see also 6 . These data are also available from the data archive of the Journal of Applied Econometrics 6 6 6 http://qed.econ.queensu.ca/jae/1997-v12.3/deb-trivedi/ . For R users, they are furthermore available under the name NMES1988 from the R package AER ( 20 ) , where a detailed description of all variables can be found. The response is the number of physician office visits, visits , with a maximum count of 89 . The regressors adl , afam , age , chronic , employed , gender , health , income , insurance and married provide information on the health and the socioeconomic status of the sample persons. Figure 3 shows the rootogram for the model using all regressors, confirming that the geometric regression model is a suitable choice for these data. We therefore use \displaystyle f(y_{i};x_{i},\mu_{i})\penalty\ =\penalty\ \dfrac{\mu_{i}^{y_{i}}}{(1+\mu_{i})^{(y_{i}+1)}},\penalty\ \penalty\ \text{for}\penalty\ y_{i}\in\mathbb{N}_{0}, (28) where \mu_{i}=\mathsf{E}(y_{i}\mid x_{i}) and \eta_{i}\penalty\ =\penalty\ \log(\mu_{i}) . As is common with count data, a log link is used, although this is not the canonical link for the model at hand. The Shapley values are obtained using R^{2}_{\text{KL}} , here of the form ( 8 ) \displaystyle R^{2}_{\text{KL,geo}} \displaystyle=1-\dfrac{\sum_{i=1}^{n}\left[y_{i}\log\left(y_{i}/\hat{\mu}_{i}\right)-(1+y_{i})\log\left((1+y_{i})/(1+\hat{\mu}_{i})\right)\right]}{\sum_{i=1}^{n}\left[y_{i}\log\left(y_{i}/\bar{y}\right)-(1+y_{i})\log\left((1+y_{i})/(1+\bar{y})\right)\right]}. (29) Table 5: Largest five Shapley values for the geometric regression model, for v=R^{2}_{\text{KL}} . chronic health insurance adl afam v(P) v=R^{2}_{\text{KL}} 0.0535 0.0233 0.0086 0.0056 0.0017 0.0953 Table 5 gives the Shapley values based on R^{2}_{\text{KL}} . We refrain from comparing this with alternative measures of fit, as we are not aware of empirical work using variable importance measures in conjunction with geometric regression. The predictor chronic , which corresponds to the number of chronic conditions, has the largest contribution, followed by health . However, while chronic has a large relative importance within the fitted model, namely impFM_{\texttt{chronic}}=56.14\% , the explanatory power of the full model is not impressive, with R^{2}_{\text{KL}} approximately equal to 9.53\% . The absolute importance of chronic is about 5.35\% . Thus, the regressor chronic explains only 5.35\% of the total empirical uncertainty and therefore seems to have limited explanatory power regarding the number of physician office visits. This example again highlights the usefulness of goodness-of-fit measures that have the properties from Section 3 and thus allow interpretation in terms of absolute importance. 6 Conclusion Understanding the importance of explanatory variables in regression models is of central interest in many fields. One popular approach is based on the Shapley value, a concept originating from game theory. A key component in calculating the Shapley value is the characteristic function or, in regression terminology, a suitable goodness-of-fit measure. In statistical literature, this idea has primarily been applied to linear regression models, for which the classical R^{2} is a natural starting point. In this context, the Shapley values offer a ‘fair’ decomposition of the classical R^{2} . However, there is currently no widely accepted framework for evaluating variable importance in GLMs. We present a unified approach for GLMs, building on previous contributions for linear regression and for binary response models. We also present and discuss desirable properties of goodness-of-fit measures, some of which apply to regression models beyond GLMs. We demonstrate that these properties enable Shapley values to be interpreted as measures of relative and absolute importance. Furthermore, we propose using the Kullback-Leibler R^{2} , which, for GLMs, is identical to the fraction of deviance explained and generalizes several well-known fit measures, such as the classical R^{2} and McFadden’s likelihood ratio index for binary response models. The Kullback-Leibler R^{2} may also be the goodness-of-fit measure of choice for several nonlinear regression models that are not based on distributions that form an exponential family. This is currently under investigation. However, the present paper takes the first steps beyond the GLM framework by using a Poisson hurdle model in Section 5 . This model has GLM building blocks, but its two-part structure makes it more flexible than a GLM. Appendix A Relationships among goodness-of-fit measures and (pseudo-) Shapley values This appendix outlines the relationships among four goodness-of-fit measures, R_{\text{KL}}^{2} , R_{\text{McF}}^{2} , \ell-\ell(\varnothing) and \ell , and the corresponding (pseudo-) Shapley values. First, as these quantities are all linearly related, we can study the relationships in one go. Specifically, consider a set of regressors P and two linearly related goodness-of-fit measures, v_{2}(S)=a\,v_{1}(S)+b , where a,\,b\in\mathbb{R} and S\subseteq P is some subset of the available regressors. In view of equation ( 1 ) the shift term b drops out, so the resulting (pseudo-) Shapley values are proportional to each other: namely, \varphi_{i}(P,v_{2})=a\,\varphi_{i}(P,v_{1}) . Note also that if a fit measure v does not satisfy v(\varnothing)=0 , we obtain pseudo-Shapley values \varphi^{*}_{i}(P,v) . From equations ( 13 ) and ( 11 ) we can write, for given data \mathbf{y} and a subset S of regressors leading to predictions \hat{\mu}_{S} , R^{2}_{\text{KL}}(\hat{\mu}_{S})\penalty\ =\penalty\ \frac{\ell(\mathbf{y},\hat{\mu}_{S})-\ell(\mathbf{y},\hat{\mu}_{0})}{\ell(\mathbf{y},\mathbf{y})-\ell(\mathbf{y},\hat{\mu}_{0})}, (30) where \ell(\mathbf{y},\mathbf{y}) represents the log-likelihood of the saturated model. As before, it is convenient to express this identity in terms of the relevant subset S , by using R^{2}_{\text{KL}}(S)=R^{2}_{\text{KL}}(\hat{\mu}_{S}) and \ell(S)=\ell(\mathbf{y},\hat{\mu}_{S}) , with S\subseteq P . As in Section 3.3 , let P^{\prime} denote the saturated model. Then, equation ( 30 ) can be reformulated as R^{2}_{\text{KL}}(S)\penalty\ =\penalty\ \frac{1}{\ell(P^{\prime})-\ell(\varnothing)}\,\ell(S)-\frac{\ell(\varnothing)}{\ell(P^{\prime})-\ell(\varnothing)}; (31) it follows that \varphi_{i}(P,R^{2}_{\text{KL}})\penalty\ =\penalty\ \frac{1}{\ell(P^{\prime})-\ell(\varnothing)}\,\varphi^{*}_{i}(P,\ell). (32) Similarly, equation ( 17 ), reformulated in terms of sets of regressors, leads to R^{2}_{\text{KL}}(S)\penalty\ =\penalty\ \frac{-\ell(\varnothing)}{\ell(P^{\prime})-\ell(\varnothing)}\,R^{2}_{\text{McF}}(S); (33) it follows that \varphi_{i}(P,R^{2}_{\text{KL}})\penalty\ =\penalty\ \frac{-\ell(\varnothing)}{\ell(P^{\prime})-\ell(\varnothing)}\,\varphi_{i}(P,R^{2}_{\text{McF}}). (34) Finally, the relation between \ell(S)-\ell(\varnothing) and \ell(S) is obviously linear, with a=1 , hence \varphi_{i}(P,\ell-\ell(\varnothing))\penalty\ =\penalty\ \varphi^{*}_{i}(P,\ell). (35) Note that using R_{\text{KL}}^{2}(S) , R_{\text{McF}}^{2}(S) or \ell-\ell(\varnothing) results in Shapley values, whereas using \ell(S) results in pseudo-Shapley values. A goodness-of-fit measure is monotonically increasing with respect to the addition of a new regressor. This results in a positive multiplicative constant in equation ( 31 ), hence a mapping from and to positive Shapley values. The sign of the multiplicative constant in equation ( 33 ) is less obvious, because the sign of the log-likelihood depends on the model and the data at hand. However, for binary response models the log-likelihood is always nonpositive; therefore, the multiplicative constant in equation ( 33 ) is nonnegative for these models. (In fact, it is equal to one, since McFadden’s likelihood ratio index, R^{2}_{\text{McF}} , is equal to R^{2}_{\text{KL}} in this case.)