Learn R Programming

sentometrics (version 0.2)

plot_attributions: Plot prediction attributions at specified level

Description

Shows a plot of the attributions along the dimension provided, stacked per date.

Usage

plot_attributions(attributions, group = "features")

Arguments

attributions

an output from a retrieve_attributions call.

group

a value from c("lexicons", "features", "time").

Value

Returns a simple ggplot object, which can be added onto (or to alter its default elements) by using the + operator (see examples). By default, a legend is positioned at the top if the number of components of the dimension (thus, individual line graphs) is at maximum twelve.

Details

See sento_model for an elaborate modelling example including the calculation and plotting of attributions. This function does not handle the plotting of the attribution of individual documents, since there are often a lot of documents involved and they appear only once at one date (even though a document may contribute to predictions at several dates, depending on the number of lags in the time aggregation).