| sentiment_series | R Documentation | 
Compute a sentiment time series based on the internal sentiment
and dates of a sentopicmodel. The time series computation supports
multiple sampling period and optionally allow computing a moving average.
sentiment_series(
  x,
  period = c("year", "quarter", "month", "day"),
  rolling_window = 1,
  scale = TRUE,
  scaling_period = c("1900-01-01", "2099-12-31"),
  as.xts = TRUE,
  ...
)
| x | a  | 
| period | the sampling period within which the sentiment of documents
will be averaged.  | 
| rolling_window | if greater than 1, determines the rolling window to compute a moving average of sentiment. The rolling window is based on the period unit and rely on actual dates (i.e, is not affected by unequally spaced data points). | 
| scale | if  | 
| scaling_period | the date range over which the scaling should be applied. Particularly useful to normalize only the beginning of the time series. | 
| as.xts | if  | 
| ... | other arguments passed on to  | 
A time series of sentiment, stored as an xts::xts or data.frame.
sentopics_sentiment sentopics_date
Other series functions: 
proportion_topics(),
sentiment_breakdown(),
sentiment_topics()
lda <- LDA(ECB_press_conferences_tokens)
series <- sentiment_series(lda, period = "month")
# JST and rJST models can use computed sentiment from the sentiment layer,
# but the model must be estimated first.
rjst <- rJST(ECB_press_conferences_tokens, lexicon = LoughranMcDonald)
sentiment_series(rjst)
sentopics_sentiment(rjst) <- NULL ## remove existing sentiment
rjst <- fit(rjst, 10) ## estimating the model is then needed
sentiment_series(rjst)
# note the presence of both raw and scaled sentiment values
# in the initial object
sentopics_sentiment(lda)
sentopics_sentiment(rjst)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.