var_imp
calculates the importance of the covariates of the model.
var_imp(state_mat, action_vec, data, outcome, period, measure)
state_mat | Numeric matrix with rows as states and columns as predictors. |
---|---|
action_vec | Numeric vector indicating what action to take for each state. |
data | Data frame that has "period" and "outcome" columns and rest of cols are predictors, ranging from one to three predictors. All of the (3-5 columns) should be named. |
outcome | Numeric vector same length as the number of rows as data. |
period | Numeric vector same length as the number of rows as data. |
measure | Optional length one character vector that is either:
"accuracy", "sens", "spec", or "ppv". This specifies what measure of
predictive performance to use for training and evaluating the model. The
default measure is |
Numeric vector the same length as the number of columns of the provided state matrix (the number of predictors in the model) with relative importance scores for each predictor.
Takes the state matrix and action vector from an already evolved model and the fitness function and data used to evolve the model (or this could be test data), flips the values of each of the elements in the state matrix and measures the change in fitness (prediction of data) relative to the original model. Then these changes are summed across columns to provide the importance of each of the columns of the state matrix.