Answered step by step
Verified Expert Solution
Question
1 Approved Answer
library ( tidyverse ) #data manipulation & plotting library ( stringr ) # text cleaning and regular expressions library ( tidytext ) # provides additional
librarytidyverse #data manipulation & plotting
librarystringr # text cleaning and regular expressions
librarytidytext # provides additional text mining functions
LOTR readRDSLOTRRDS ## read in the text of
stopwords tidytext::stopwords
tokens LOTR unnesttokens word text
tokens tokens dplyr::filterword in stopwords $ word
allwordcounts tokens groupbybook chapter
count word sort TRUE ungroup
allwordcountsmat allwordcounts spread keyword, valuen fill
wordcounts allwordcountsmat ring
Plot the loglikelihood of the Poisson rate of usage of the word in wordcounts. Then use wordcounts
to compute the maximum likelihood estimate of the rate of the usage of the word in the LOTR. Mark
this maximum on the loglikelihood plot with a vertical line use abline if you make the plot in base or
geomvline if you prefer ggplot
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started