vadis_line3: Calculate the third line of evidence for the VADIS method

View source: R/vadis_line3.R

vadis_line3R Documentation

Calculate the third line of evidence for the VADIS method

Description

Calculate the third line of evidence for the VADIS method

Usage

vadis_line3(
  mod_object,
  path = NULL,
  conditional = TRUE,
  overwrite = c("no", "yes", "reload"),
  verbose = FALSE
)

Arguments

mod_object

Either a list of random forest model objects, or a dataframe of variable importance scores, where rows represent predictors in the models and columns represent the varieties to compare.

path

Path in which to save the output as an R data file (.rds). If NULL, defaults to the current working directory. Set path = FALSE if you do not wish to save to file.

conditional

logical. Should conditional (default) or unconditional permutation variable importance be computed. Only applies to RandomForest-class models from the party package.

overwrite

Should the function overwrite data to location in path? Default is 'no', which will run the analysis if no file exists. If file in path exists, user with be prompted to set new path or allow file to be overwritten. Set to 'yes' to automatically overwrite existing file, and 'reload' to automatically reload existing file.

verbose

Should messages be printed? Default is FALSE

Details

The function loops through a list of model objects, extracts the coefficient estimates, and compiles them in a single dataframe.

Value

A list of length 4.

varimp.table

A dataframe of P predictors by M random forest models, containing the variable importance scores obtained for each predictor in the models.

rank.table

A dataframe of P predictors by M random forest models, containing the rankings of predictors in each model by variable importance score in varimp.table.

distance.matrix

An M by M distance matrix of class dist, derived from rank.table. Values are calculated as 1 - the Spearman rank correlation \rho.

similarity.scores

A dataframe of similarity scores derive from distance.matrix. See Szmrecsanyi et al. (2019) for details.

Author(s)

Jason Grafmiller

References

Szmrecsanyi, Benedikt, Jason Grafmiller & Laura Rosseel. 2019. Variation-Based Distance and Similarity Modeling: A Case Study in World Englishes. Frontiers in Artificial Intelligence 2. https://doi.org/10.3389/frai.2019.00023.

Examples

## Not run: 
data_list <- split(particle_verbs_short, particle_verbs_short$Variety, drop = TRUE)

fmla <- Response ~ DirObjWordLength + DirObjDefiniteness + DirObjGivenness + DirObjConcreteness + DirObjThematicity + DirectionalPP + PrimeType + Semantics + Surprisal.P + Surprisal.V + Register

rf_func <- function(x) ranger(fmla, data = x, importance = "permutation")

rf_list <- lapply(data_list, rf_func)
names(rf_list) <- names(data_list)

line3 <- vadis_line3(rf_list, path = FALSE)

## End(Not run)

jasongraf1/VADIS documentation built on July 19, 2023, 10:26 p.m.