Hello,
Thanks for your help! I actually solved the previous issue (with some other help) of the glm fit error but can't get to visualise my model (which is a bit annoying of course). I used the LLM package (https://cran.r-project.org/web/packages/LLM/LLM.pdf). Here's the reprex:
## Libraries
library(tidyverse)
library(LLM)
library(readxl)
library(janitor)
## reading the churnDV
churnDV_df <- read_excel("ChurnDV.xlsx")
#> Error: `path` does not exist: 'ChurnDV.xlsx'
glimpse(churnDV_df)
#> Error in glimpse(churnDV_df): object 'churnDV_df' not found
## convert the true/false entry to factor
churnDV_df <- churnDV_df %>% mutate(churn_dummy = factor(churn_dummy, levels = c("true", "false")))
#> Error in eval(lhs, parent, parent): object 'churnDV_df' not found
## reading the churnIV dataset
churnIV_df <- read_excel("ChurnIV.xlsx") %>%
clean_names()
#> Error: `path` does not exist: 'ChurnIV.xlsx'
glimpse(churnIV_df)
#> Error in glimpse(churnIV_df): object 'churnIV_df' not found
## converted the churn_dummy variable into a binary variable
churnIV_df <- churnIV_df %>% mutate(churn_dummy = ifelse(churn_dummy == 1, "true", "false"),
churn_dummy = factor(churn_dummy)) %>%
as.data.frame()
#> Error in eval(lhs, parent, parent): object 'churnIV_df' not found
## Actual Model Implementation
churn.llm <- llm(X = churnIV_df[, -c(14)], Y = churnIV_df$churn_dummy,
threshold_pruning = 0.10, nbr_obs_leaf = 500)
#> Error in nrow(X): object 'churnIV_df' not found
churn.llm
#> Error in eval(expr, envir, enclos): object 'churn.llm' not found
## Actual Model Implementation
churn.llm.cv <- llm.cv(X = churnIV_df[, -c(14)], Y = churnIV_df$churn_dummy, cv = 10,
threshold_pruning = 0.10, nbr_obs_leaf = 500)
#> Error in cbind(Y, X): object 'churnIV_df' not found
churn.llm.cv
#> Error in eval(expr, envir, enclos): object 'churn.llm.cv' not found
## Save the output of the model to a html file
churn.viz <- table.llm.html(object = churn.llm, headertext = "LLM applied to churn", footertext = "R output", roundingnumbers = 2)
#> Error in table.llm.html(object = churn.llm, headertext = "LLM applied to churn", : object 'churn.llm' not found
## Optionaly write it to your working directory
write(churn.viz, "Visualization_LLM_on_churn.html")
#> Error in cat(x, file = file, sep = c(rep.int(sep, ncolumns - 1), "\n"), : object 'churn.viz' not found```