en_kfold_accuracy: en_kfold_accuracy function

View source: R/enr functions.R

en_kfold_accuracyR Documentation

en_kfold_accuracy function

Description

This function calculates the cross validated accuracy of an enr model

Usage

en_kfold_accuracy(
  ddata,
  response_var,
  mod_alpha,
  mod_lambda = NULL,
  iter = 100,
  k = 10,
  seed = 123,
  loo = FALSE,
  eq_wt = FALSE,
  type_meas = "deviance",
  lr_cutoff = c(0.5)
)

Arguments

ddata

data frame containing the data to be summarized

response_var

vector of variable names for the variables that are t be summarized. all variables must be present in the data frame

mod_alpha

optional class variable to cross with the independent variables. this is is typically presented as a text (e.g. data$variable)vector of names to change the rows in column 1 to. This is typically what you want the individual variables that the rows represent called in the table. this must be the same length as vars. default is NULL which simply returns vars.

mod_lambda

vector of boolean values indicating whether the variable should be 'fp' (true) or custom/msd (false). default is true

iter

a vector of the first function to use (i.e. outside the parentheses) if fp='FALSE'. default is 'mean'. if supplying different functions be sure to quote e.g. "IQR"

k

a vector of the second function to use (i.e. inside the parentheses) if fp='FALSE'. default is 'sd'. if supplying different functions be sure to quote e.g. "IQR"

seed

a vector of variable names to use in the table. If left as null the table will contain the variable names as listed in the data frame

loo

boolean value indicating whether the variable name should be added to the table (TRUE) or not (FALSE). default is TRUE

eq_wt

boolean indicating whether duplicate values of the variable name should be removed (TRUE) or included (FALSE). default is TRUE

type_meas

boolean indicating if the n value used after na removal should be displayed in non fp cases. this will only appear when fp=FASLE. default is TRUE

lr_cutoff

boolean indicating if a 'total' column should be added to the data frame. default is TRUE

Examples

en_kfold_accuracy()


clmacleod/highlandr documentation built on Feb. 18, 2025, 1:31 p.m.