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 designed to do time series analysis based on textual sentiment. Put differently, it is an integrated framework for textual sentiment time series aggregation and prediction. It accounts for the intrinsic challenge that, for a given text, sentiment can be computed in many different ways, as well as the large number of possibilities to pool sentiment across texts and time. This additional layer of manipulation does not exist in standard text mining and time series analysis packages. As a final outcome, the package provides an automated means to econometrically model the impact of sentiment in texts on a given variable, by first computing a wide range of textual sentiment time series and then selecting those that are most informative. The package created therefore integrates the qualification of sentiment from texts, the aggregation into different sentiment measures and the optimized prediction based on these measures.

The package implements the main methodology developed in the paper "Questioning the news about economic growth: Sparse forecasting using thousands of news-based sentiment values" (Ardia, Bluteau and Boudt, 2017). See the vignette for an introduction to the package. In future releases, the package will be expanded in multiple directions while further improving its present setting.

Installation

The latest development version of sentometrics is available at https://github.com/sborms/sentometrics. To install this version (which may contain bugs!), execute:

devtools::install_github("sborms/sentometrics")

References

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

Acknowledgements

This software package originates from a Google Summer of Code 2017 project.

Copy Link

Version

Install

install.packages('sentometrics')

Monthly Downloads

453

Version

0.2

License

GPL (>= 2)

Issues

Pull Requests

Stars

Forks

Maintainer

Samuel Borms

Last Published

November 13th, 2017

Functions in sentometrics (0.2)

add_features

Add feature columns to a sentocorpus
almons

Compute Almon polynomials
retrieve_attributions

Retrieve top-down sentiment attributions given model object
scale.sentomeasures

Scaling and centering of sentiment measures
select_measures

Select a subset of sentiment measures
sento_corpus

Create a sentocorpus object
epu

Monthly Economic Policy Uncertainty Index
exponentials

Compute exponential weighting curves
perform_MCS

Apply model confidence set (MCS) procedure to a selection of models
perform_agg

Aggregate textual sentiment across documents and time
sento_measures

One-way road towards a sentomeasures object
sento_model

Optimized and automated sparse regression
compute_sentiment

Compute document-level sentiment across features and lexicons
ctr_agg

Set up control for aggregation into sentiment measures
plot.sentomeasures

Plot sentiment measures
plot.sentomodeliter

Plot iterative predictions versus realized values
sentometrics-package

An Integrated Framework for Textual Sentiment Time Series Aggregation and Prediction
setup_lexicons

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

Set up control for merging sentiment measures
ctr_model

Set up control for sentiment measures-based regression modelling
fill_measures

Add and fill missing dates
get_hows

Options supported to perform aggregation into sentiment measures
lexicons

Built-in lexicons
merge_measures

Merge sentiment measures
valence

Built-in valence word lists
plot_attributions

Plot prediction attributions at specified level
predict.sentomodel

Make predictions from a sentomodel object
to_global

Merge sentiment measures into one global sentiment measure
usnews

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