1
$\begingroup$

I was adviced to write in this group regarding my question about modeling categorical database. I have a customer dataset, which is a survey result. I have 1595 obs. and about 200 columns(200 because most of the cases the questions were multiple choice and we had to split it into columns). Majority of variables are categorical or binary. I do not have continous variables at all. My task is to do customer segmentation, clustering. There is no initial assumptions although as I have also the questionnaire so can logically seperate the important questions.

I face several issues regarding the modeling

  1. I need to validate the choice of variables i use
  2. I am trying to find associations, pairwise associations and trends, as I do not have initial assumtions who can be my segments
  3. Clustering models are not working good for categorical variables and the ones I tried for example kmods, ignore the associations, correlations and return me not clear picture.

Can you please suggest how to approach, or from where to start. I am new in data analytics and I need some hints to go on with the analysis and I will be grateful to have some guidance at least high level what can be done.

Thanks in advance!

$\endgroup$

1 Answer 1

1
$\begingroup$

You can use mixture model with variable selection. In this framework, the challenge of variable selection consists in model selection. Thus, detection of the relevant features and estimation of the number of clusters can be done according to information criteria (like BIC or ICL).

To perform this analysis, you can use the R package VarSelLCM. Because you consider categorical variables, your dataset must be a data.frame and each column must be a factor. Here is an example of the script. Your dataset is denoted by "my.data".

## Clustering by considering all the variables as discriminative
# Number of clusters is between 1 and 6
res.all <- VarSelCluster(my.data, 1:6, vbleSelec = FALSE)

# partition
res.all@partitions@zMAP

# shiny application
VarSelShiny(res.all)


## Clustering with variable selection
# Number of clusters is between 1 and 6
res.selec <- VarSelCluster(my.data, 1:6, vbleSelec = TRUE)

# partition
res.selec@partitions@zMAP

# shiny application
VarSelShiny(res.selec)
$\endgroup$
2
  • $\begingroup$ Thanks a lot for your reply! I tried the code on my dataset, although I have all my variables as factors in dataframe. i receive an error that at least one is not and some additinal 50 warnings ahead. I will try to figure it out and see what are the results for this method. Thank you very much for supprot! $\endgroup$
    – Sara
    Mar 29, 2018 at 19:17
  • $\begingroup$ About the warnings, they appear if some levels are not taken by any observations. About the error, may be you can convert each column as factor, see the R code below my.data <- as.data.frame(my.data) for (j in 1:ncol(my_data)) my.data[,j] <- as.factor(my.data[,j]) $\endgroup$
    – user200668
    Mar 29, 2018 at 19:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.