Can dummy variables be used to represent space in latent Dirichlet allocation?

I have a set of geocoded textual documents. I would like to use LDA to generate a topic model for the documents. Intuitively, I would think that documents that are near each other spatially are more likely to have the same topic but I don’t know how to represent space in the R packages for topic models.

I thought about binning the documents by space and assigning the bin name as a term that occurs in each document (e.g. all documents from Kenya would be annotated with “Kenya”). Does this violate the model assumptions? Is there any point to doing this? To be honest, I don’t know how LDA works and I’m trying to work through tutorials and play with my dataset to understand it.


1 Answer 1


The simplest solution would be to add the location as text in a consistent manner to the main text you are generating topics from. If data are heavily correlated by location, this could be your initial binning/cluster step, and you can follow this step by a second LDA run without the location. Otherwise, if you still want to mix them, then you can up-weight other terms in your stemming step, and keep the weight of the location terms lower. You'll just have to play a bit with it to see.

That said, yes, dummy variables are fine in LDA if you understand them, as is a separate unrelated binning step like you suggested.


Your Answer

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

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