# R package topicmodels, how are probabilities calculated in case of trained model with new text [closed]

When scoring new text documents with a trained topic model (LDA() function in r package topic model) the posterior() function gives back topic probabilities for each topic, but also topic probabilities of each word. Simply adding (by hand) these word probabilities doesn't give back the same topic probabilities that the posterior() function gives back. My question is: how are the probabilities per word used to calculate the topic probabilities?

## migration rejected from stackoverflow.comApr 23 at 13:52

This question came from our site for professional and enthusiast programmers. Votes, comments, and answers are locked due to the question being closed here, but it may be eligible for editing and reopening on the site where it originated.

## closed as off-topic by gung♦Apr 23 at 13:52

This question appears to be off-topic. The users who voted to close gave this specific reason:

• "This question appears to be off-topic because EITHER it is not about statistics, machine learning, data analysis, data mining, or data visualization, OR it focuses on programming, debugging, or performing routine operations within a statistical computing platform. If the latter, you could try the support links we maintain." – gung
If this question can be reworded to fit the rules in the help center, please edit the question.

• Presumably, you need to read the documentation for this. As currently phrased, this question seems borderline & at risk of being closed as off topic here. Can you edit this to make it less about how the package works & more about how the underlying methods work? You may also want to add a small example to illustrate your question. – gung Apr 22 at 18:43
• I will do that! And you are absolutely right – rdatasculptor Apr 22 at 20:21