Description Usage Arguments Value Examples
Fit a Generalized Word Power model on a target variable using word frequency data with an elastic-net model.
1 2 |
frequencies |
frequencies data.table generated using the function |
responseData |
data.frame with column |
alpha |
alpha parameter for an elastic-net model. |
lowerLimit |
lower limit on the number of time a sentiment word must appear over all the period. If the value is above or equal to 1, this value is absolute. If the value is below 1, this value is in percentage term. |
A list with the following elements:
scores: data.frame wiht the column word
, score
, and importance
.
the word column correspond to the sentiment words, the score column correspond to the polarity of the sentiment words,
and the importance column correspond to the importance of each word withing the calbration sample.
sentiment: data.frame with colmn regID
, SentimentScores
, and y
.
the column regID correspond to the regID of each observation, the columne SentimentScores is the sentiment for that observation,
and the column y is the initially given reponse variable.
1 2 3 4 5 6 7 8 9 10 11 12 | # Load example data
data("corpus", package = "GWP")
data("vix", package = "GWP")
# Setup the lexicons
sentimentWord <- sentometrics::list_lexicons$LM_en$x
shifterWord <- sentometrics::list_valence_shifters$en[, c("x", "y")]
# Generate the frequency data
frequencies <- computeFrequencies(corpus, sentimentWord, shifterWord, clusterSize = 5)
# Calibrate the lexicon
res = fitGWP(frequencies = frequencies, responseData = vix)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.