Relative Importance Analysis for Non-negative Linear Regression I have a set of 32 intercorrelated variables and a target. I hypothesised that these variables would linearly and positively contributed to the target, and hence a non-negative linear regression model is adopted. However, I would like to investigate on the relative importance of variables, instead of the correlation coefficient, given the multicollinearity of the variables. It seems that the relative importance analysis (Johnson & LeBreton, 2004) did not allow a non-negative constraints. Is there any kinds of analysis that I retrieve the relative importance while maintaining the non-negative constraints? Lots of thanks!
 A: This can be accomplished using the {domir} package.
For instance, consider this model using nnls::nnls in R.
nnls::nnls(mtcars[c('qsec', 'vs', 'am')] |> as.matrix(), 
   mtcars$mpg)

Nonnegative least squares model
x estimates: 0.8537898 4.468002 7.16467 
residual sum-of-squares: 317.7
reason terminated: The solution has been computed sucessfully.

That model produces an $R^2$ like:
> nnls::nnls(mtcars[c('qsec', 'vs', 'am')] |> as.matrix(), 
   mtcars$mpg) |> 
   fitted.values() |> cor(mtcars$mpg) |> (\(x){(x**2)[[1]]})()

[1] 0.7179187

This model can be accommodated, with the $R^2$ it produced, using an approach like:
domir::domir(
  ~ qsec + vs + am, 
  \(fml, ...) {
    
    terms <- terms(fml) |> (\(x) attributes(x)[["term.labels"]] )()
    
    mod <- 
      nnls::nnls(
        mtcars[terms] |> as.matrix(), 
        mtcars$mpg 
      )
    
    r2 <- mod |> fitted.values() |> cor(mtcars$mpg) |> (\(x){(x**2)[[1]]})()
    
    return(r2)
    
  }
)

Overall Value:      0.7179187 

General Dominance Values:
     General Dominance Standardized Ranks
qsec         0.1006883    0.1402503     3
vs           0.2659427    0.3704357     2
am           0.3512877    0.4893140     1

Conditional Dominance Values:
     Subset Size: 1 Subset Size: 2 Subset Size: 3
qsec      0.1752963      0.0948123     0.03195626
vs        0.4409477      0.2600667     0.09681373
am        0.3597989      0.3454117     0.34865241

Complete Dominance Designations:
             Dmnated?qsec Dmnated?vs Dmnated?am
Dmnates?qsec           NA      FALSE      FALSE
Dmnates?vs           TRUE         NA         NA
Dmnates?am           TRUE         NA         NA
```

