Learn R Programming

⚠️There's a newer version (1.0.1) of this package.Take me there.

sentometrics: An Integrated Framework for Textual Sentiment Time Series Aggregation and Prediction

Introduction

The sentometrics package is an integrated framework for textual sentiment time series aggregation and prediction. It accounts for the intrinsic challenge that textual sentiment can be computed in many different ways, as well as the large number of possibilities to pool sentiment into a time series index. The package integrates the fast quantification of sentiment from texts, the aggregation into different sentiment time series, and the prediction based on these measures. All in one coherent workflow!

See the package website and the vignette for plenty of examples and details. We also refer to our survey organized as an overview of the required steps in a typical econometric analysis of sentiment from alternative (such as textual) data, and following companion web page.

Installation

To install the package from CRAN, simply do:

install.packages("sentometrics")

To install the latest development version of sentometrics (which may contain bugs!), execute:

devtools::install_github("SentometricsResearch/sentometrics")

Shiny application

For a visual interface as a Shiny application of the package's core functionalities, install the sentometrics.app package, and run the sento_app() function.

Reference

Please cite sentometrics in publications. Use citation("sentometrics").

Acknowledgements

This software package originates from a Google Summer of Code 2017 project, was further developed during a follow-up Google Summer of Code 2019 project, and benefited generally from financial support by Innoviris, IVADO, swissuniversities, and the Swiss National Science Foundation (grants #179281 and #191730).

Copy Link

Version

Install

install.packages('sentometrics')

Monthly Downloads

453

Version

1.0.0

License

GPL (>= 2)

Maintainer

Samuel Borms

Last Published

August 18th, 2021

Functions in sentometrics (1.0.0)

add_features

Add feature columns to a (sento_)corpus object
as.sentiment

Convert a sentiment table to a sentiment object
corpus_summarize

Summarize the sento_corpus object
compute_sentiment

Compute textual sentiment across features and lexicons
as.sento_corpus

Convert a quanteda or tm corpus object into a sento_corpus object
attributions

Retrieve top-down model sentiment attributions
aggregate.sento_measures

Aggregate sentiment measures
ctr_agg

Set up control for aggregation into sentiment measures
as.data.table.sento_measures

Get the sentiment measures
aggregate.sentiment

Aggregate textual sentiment across sentences, documents and time
diff.sento_measures

Differencing of sentiment measures
peakdocs

Extract documents related to sentiment peaks
epu

Monthly U.S. Economic Policy Uncertainty index
get_hows

Options supported to perform aggregation into sentiment measures
merge.sentiment

Merge sentiment objects horizontally and/or vertically
sentometrics-defunct

Defunct functions
get_loss_data

Retrieve loss data from a selection of models
nmeasures

Get number of sentiment measures
nobs.sento_measures

Get number of observations in the sentiment measures
peakdates

Extract dates related to sentiment time series peaks
get_dates

Get the dates of the sentiment measures/time series
ctr_model

Set up control for sentiment-based sparse regression modeling
data-defunct

Datasets with defunct names
predict.sento_model

Make predictions from a sento_model object
plot.sento_measures

Plot sentiment measures
get_dimensions

Get the dimensions of the sentiment measures
plot.sento_modelIter

Plot iterative predictions versus realized values
sentometrics-package

sentometrics: An Integrated Framework for Textual Sentiment Time Series Aggregation and Prediction
subset.sento_measures

Subset sentiment measures
weights_exponential

Compute exponential weighting curves
weights_beta

Compute Beta weighting curves
scale.sento_measures

Scaling and centering of sentiment measures
sentometrics-deprecated

Deprecated functions
list_valence_shifters

Built-in valence word lists
measures_update

Update sentiment measures
measures_fill

Add and fill missing dates to sentiment measures
sento_corpus

Create a sento_corpus object
sento_lexicons

Set up lexicons (and valence word list) for use in sentiment analysis
list_lexicons

Built-in lexicons
plot.attributions

Plot prediction attributions at specified level
sento_model

Optimized and automated sentiment-based sparse regression
sento_measures

One-way road towards a sento_measures object
usnews

Texts (not) relevant to the U.S. economy
weights_almon

Compute Almon polynomials