title: Evaluate stm Model
body: <p>I´m working on a STM Model (topicmodelling) and i´d like to evaluate and verify the model, but i´m not sure how to do it. My code is:</p>
  
  <pre><code>Corpus.STM &lt;- readCorpus(dtm, type = "slam")
  </code></pre>
  
  <h1>Model choice:</h1>
  
  <pre><code>BestM1. &lt;- searchK(Corpus.STM$documents, Corpus.STM$vocab, K=c(10,20, 30, 40, 50, 60), proportion = .4, heldout.seed = 1, prevalence=~ cvJahr+ cvDienstgrad+ cvLand, data=Jahr.Land )
  BestM2. &lt;- searchK(Corpus.STM$documents, Corpus.STM$vocab, K=c(85,110), proportion = .4, heldout.seed = 1, prevalence=~ cvJahr+ cvDienstgrad+ cvLand, data=Jahr.Land )
  BestM3. &lt;- searchK(Corpus.STM$documents, Corpus.STM$vocab, K=c(20,21,22,23,24,25,26,27,28,29,30), proportion = .4, heldout.seed = 1, prevalence=~ cvJahr+ cvDienstgrad+ cvLand, data=Jahr.Land )
  
  str(BestM1.)
  plot.searchK(BestM1.)
  plot.STM(BestM2)
  plot.searchK(BestM3.)
  #27 seems to be a good choice
  #Heldout
  set.seed(1)
  heldout&lt;- make.heldout(Corpus.STM$documents, Corpus.STM$vocab, proportion = .5,seed = 1)
  stm.mod1 &lt;- stm(heldout$documents, heldout$vocab, K =27, seed = 1, init.type = "Spectral", max.em.its = 100 )
  heldout.evaluation &lt;- eval.heldout(stm.mod1, heldout$missing)
  heldout.evaluation
  #evaluation heldout
  labelTopics(stm.mod1) 
  plot.STM(stm.mod1, type="labels", n=5, frexweight = 0.25)
  cloud(stm.mod1, topic=5)
  plot.STM(stm.mod1, type="summary", labeltype="frex", topics=c(1:5), n=8)
  </code></pre>
  
  <p>I´m not sure how to interpret the output of "eval.heldout". Additional I want to make sure that the model doesn´t overfit, but i´m not sure how it could work. </p>