On joint dimension reduction and clustering of categorical data