Cacul de risque

Bonjour,

J'ai besoin d'aide car mes qualités en statistiques sont un peu rouillées.

Je suis sûre qu'il existe une méthodo quelque part de ce que je veux faire mais je n'arrive pas à la trouver.

Voilà le sujet :

J'ai une population de clients 'perdus' et une poulation de clients encore en activité. En me basant sur les variables caractérisant cette population de clients 'perdus', je dois établir un score de risque sur mes actuels clients et le représenter sous forme de graphique.

Quelle méthodo me conseillez-vous ?

Aussi, à combien de temps estimez-vous ce travail ? J'ai l'impression que ça va prendre plusieurs semaines, mais mon chef s'attend définitivement à ce que je le fasse en moins de 3 jours. Est-ce que je suis vraiment trop rouillée ou c'est lui qui ne se rend absolument pas compte du travail que ça représente ? ou les 2 ? :smiley:

Pour l'instant, j'utilise ce site : La régression logistique avec R, sa vie, son oeuvre - OD-Datamining
Mais j'ai des erreurs, bien que le site semble récent. Par exemple, avec le code suivant :

library(skimr)
pander(skim(titanic), split.tables=Inf)

R me retourne l'erreur :
Error in pander(skim(res_clust1), split.tables = Inf) :
could not find function "pander"
Même si j'ai bien (sauf erreur de ma part) déployé toutes les bibilothèques différentes.

Ce n'est pas très grave, mais j'ai des erreurs fréquentes et de mes recherches, c'est ce site qui semble correspondre le plus à mon besoin, donc ce post est surtout pour savoir si vous connaissez d'autres liens de ce genre que je n'aurais pas trouver.

Merci :slight_smile:
Emilie.

We really need a reproducible example (reprex)

For the immediate problem :
Avez-vous chargé pander?

library(skimr)
library(pander)
library(carData) # to get TitanicSurvival data

 titanic <- TitanicSurvival

 pander(skim(titanic), split.tables=Inf)

Thanks for your quick answer. :slight_smile:
I think you might prefer I speak english so I'm gonna try to be clear in english.

For the reprex :
I've done before an analysis of these lost customers, and I identified these variables are discriminating :
image

I do get these variables for the active people too.
So I think my plan would be :

I merge these 2 dataframes with a new column 'lost' to 0 or 1 .
For the quantitatives variables, I test the linearity and I merge them into slices if necessary.
(4h)

Then I apply the linear regression and try to get a significant model.

customers$mtt_cl<- fct_recode(customers$mtt_cl,
                             "(5,15]"="(5,10]",
                             "(5,15]"="(10,15]")
reg2c <- glm(lost~ mtt_cl + nb_depots + age_first_sign     ,
             titanic,
             family="binomial")
pairs(emmeans(reg2c,"mtt_cl ")) %>% 
  as.data.frame() %>% 
  arrange(desc(p.value)) %>% 
  kable()

(4h)

Based on the result of regression, I apply the function predict, and adjust the model until the risk of error is correct.

customers$p_surv <- predict(reg2g,
                          titanic,
                          type="response")
confusion <- table(customers$survived,
                   ifelse(customers$p_surv < 0.382,
                          "prédit  \"non\"",
                          "prédit  \"oui\""))

(6h)

Graphics : an expected graphic is to show the score of each active customer of 'could be lost or not'.
I guess I'll do that with :

reg2g %>%
  blr_gains_table() %>% 
  plot()

(2h)
And of course analysis for each step and interpretation.

So my question is : does that sound great ? logic and timing ? I have to do an estimation before I really do the prediction, but I haven't done that for the last 10 years so I try to get into to give the best estimation (not easy at all !)

For the immediate pb : solved with 'library(pander)' :+1:

I just don't have the expertise in gml to answer. Hopefully another reader can.

You may want to ask the question on CrossValidated which is a statistical consulting blog.

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.