I'm trying to estimate a manyTopics stm model but I get this error:
Error in vb.variational.reg(Y = lambda[, i], X = covar, Xcorr = Xcorr, : Prevalence regression failing to converge within iteration limit. May want to try gamma.prior='L1'. You >can change max iterations using control. See stm documentation
My code:
temp <- textProcessor(documents=sample$policies,
metadata=sample,
lowercase=FALSE,
removestopwords=FALSE,
removenumbers=FALSE,
removepunctuation=FALSE,
stem=FALSE,
sparselevel=.90)
meta <- temp$meta
vocab <- temp$vocab
docs <- temp$documents
out <- prepDocuments(docs, vocab, meta)
docs <- out$documents
vocab <- out$vocab
length(vocab)
meta <- out$meta
storage <- manyTopics(docs,
vocab,
K=c(12),
prevalence=~Organization+discuss,
max.em.its=500,
data=meta,
runs=50)
I only have 135 observations. Could someone please explain what the exact problem is and how could solve it.