Created
September 10, 2017 05:17
-
-
Save philohistoria/48bb4a2f7bcb8d87ee6493f34e45f36a to your computer and use it in GitHub Desktop.
Simplest workflow for STM R package
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(stm) | |
data <- read.csv("pol.csv") | |
processedtest <- textProcessor(data$documents, metadata = data) | |
outtest <- prepDocuments(processedtest$documents, processedtest$vocab, processedtest$meta) | |
poliblogPrevFit <- stm(documents = out$documents, vocab = out$vocab, K = 20, prevalence =~ rating + s(day), max.em.its = 10, data = out$meta, init.type = "Spectral") | |
prep <- estimateEffect(1:20 ~ rating + s(day), poliblogPrevFit, meta = out$meta, uncertainty = "Global") | |
plot(prep, "day", method = "continuous", topics = 7, model = z, printlegend = FALSE, xaxt = "n", xlab = "Time (2008)") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment