variable_importance: Variable importance

Description Usage Arguments Value Author(s) Examples

View source: R/variable_importance.R

Description

Calculate contribution of predictor variables to the model. Function will make a reference prediction of the model using the standard set of variables. Then, the values in predictor variables are randomized, and the prediction is repeated with the set of variables that contain a randomized variable. Correlation coefficient is calculated between the reference prediction and randomized prediction. Given importance value is 1 - correlation ** 2 for each variable. Number of randomizations can be set (default is one)

Usage

1
variable_importance(data, model, iterations_num = 1, clean = FALSE)

Arguments

data

Input data with variables for which to calculate the variable importance. With this data you should be able to run predict function on the model.

model

Model to be used for prediction. Function is tested only on glm object class.

iterations_num

Number of randomization iterations. Default is 1 iteration.

clean

Return cleaned data (default is FALSE). A dataframe will be returned, only with variables that participated in the model (in case of model selection).

Value

Output is a matrix where rows have variable importance value for each variable, and the columns are individual iterations. If clean = TRUE, return class is dataframe.

Author(s)

Mirza Cengic

Examples

1
var_importance(data = mydat, model = my_model, iterations_num = 10)

MirzaCengic/LUpak documentation built on July 18, 2019, 3:06 a.m.