martinctc / rwa

Package for running Relative Weights Analysis in R
https://martinctc.github.io/rwa
12 stars 8 forks source link

Categorical variables #8

Closed kaas66 closed 3 years ago

kaas66 commented 3 years ago

I have used the R-package rwa with great success when I just have numeric variables. However, I now just tried with a data set with both numeric and categorical variables and then I received an error message.

Error in cor(thedata, use = "pairwise.complete.obs") : 'x' must be numeric

I therefore wonder whether the rwa method may be used for numeric variables only or if there is a way to "convert" the categorical variables to numeric ones that makes the method work even when we have categorical variables?

martinctc commented 3 years ago

Thanks @kaas66 for this issue. The short answer is that there is currently no method using Relative Weights to use numeric predictors to estimate variable importance. There is a method to use logistic regression (binary outcomes) for rwa that we are still working on in a pull request, but it is only available as it was based on the original authors' (Tonidandel and LeBreton) work.

For your use case, I might recommend considering other methods of estimating variable importance, like with a random forest, or check out methods in the {vip} R package.

However would really welcome to get any help or support on this question!

martinctc commented 3 years ago

Closing this as this is currently beyond the scope of this package.