# Relative importance (explained variation) of variables in non-linear models

I have two variables $$x_1$$ and $$x_2$$, which are correlated. I want to know which of those variables explains more variation in $$y$$.

I know that for linear regression, there are a bunch of options (which are discussed here, in addition you can find the paper for a recommended package here: Grömping, 2006).

Regrettably, my regression is pretty poorly explained by OLS*. Instead, I am using a quasibinomial distribution (In R this corresponds to glm with family quasibinomial. In Stata this corresponds to fracreg logit). (If any of these solutions DO work for my type of model, please let me know) Nevertheless, I still want to test for relative importance, in the best way I can (in either R or Stata).

I thought the best way to test this, would to be to just normalise both variables.

1. However, now the first question arises. If I want to test which variable explains more variation in a generalized linear model,

A) do I test:

$$y = B_0 + B_1x_1 + B_2x_2 + u$$

B) Or do I test:

$$y = B_0 + B_1x_1 + u - versus - y = B_0 + B_2x_2 + u$$

Now, to make the example slightly more complicated, let's assume that $$x_1$$ is an ordinal variable. Now I know already that normalising ordinal data is at a minimum frowned upon (See for example link, link, link). Here I note that I am not looking for the perfect solution. Instead, I am looking for the best I can do. So the next question:

1. What are my options if $$x_1$$ is an ordinal variable?

If I could make it even slightly more complicated,

1. What if $$x_2$$ (NOT $$x_1$$) was a dummy variable (at this point we are comparing an ordinal variable to a dummy variable, which are correlated)?

Once again, I am not looking for perfect solutions. I am looking for the best I can do. References and package recommendations would be greatly appreciated.

*My first idea was to simply use a linear model to compare these variables. But the model was so poorly explained by OLS that I refrained.

# EDIT:

The domin (Stata-package) / domir (R-package) packages allow checking for relative importance in non-linear models. I could however not find any literature on the application in relation to non-linear models).

As @Tom noted a model like glm(family=quasibinomial()) is possible using domir::domin in R or domin from SSC in Stata (see answer on Statalist).

As applied in R, consider this model:

> mtcars2 <- cbind(mtcars, carb2 = mtcars$carb/8) > qbn_mod <- glm(carb2 ~ vs + am + disp, family=quasibinomial(), data=mtcars2) > qbn_mod Call: glm(formula = carb2 ~ vs + am + disp, family = quasibinomial(), data = mtcars2) Coefficients: (Intercept) vs am disp -0.924444 -0.835746 0.528684 0.001797 Degrees of Freedom: 31 Total (i.e. Null); 28 Residual Null Deviance: 6.02 Residual Deviance: 3.932 AIC: NA  Have to do a workaround for a fit metric. In this case, just the squared correlation between the observed and predicted values. > predict(qbn_mod, type="response") |> (\(x) cor(x, mtcars2$carb2)^2)()
[1] 0.3945242


With a fit metric, now can complete the domin call.

> domir::domin(carb2 ~ vs + am + disp, glm, list(\(x) list("R2" = cor(predict(x, type="response"), mtcars2\$carb2)^2), "R2"), family=quasibinomial(), data=mtcars2)
Overall Fit Statistic:      0.3945242

General Dominance Statistics:
General_Dominance Standardized Ranks
vs          0.22780384    0.5774141     1
am          0.05728333    0.1451960     3
disp        0.10943706    0.2773900     2

Conditional Dominance Statistics:
IVs: 1     IVs: 2     IVs: 3
vs   0.324452295 0.26944926 0.08950998
am   0.003310202 0.09892875 0.06961106
disp 0.150051448 0.15108247 0.02717726

Complete Dominance Statistics:
Dmned?vs Dmned?am Dmned?disp
Dmate?vs          0        0          1
Dmate?am          0        0          0
Dmate?disp       -1        0          0


There's a couple of papers on glms (Azen & Tranel, 2009), as well as MASS::polr and nnet::multnom (Luchman, 2014) and pscl::zeroinfl (Luchman, Lei, & Kaplan, 2020) that examine nonlinear models' importance.