Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

library ( tidyverse ) #data manipulation & plotting library ( stringr ) # text cleaning and regular expressions library ( tidytext ) # provides additional

library(tidyverse) #data manipulation & plotting
library(stringr) # text cleaning and regular expressions
library(tidytext) # provides additional text mining functions
LOTR - readRDS("LOTR.RDS") ## read in the text of
stop_words - tidytext::stop_words
tokens - LOTR %>% unnest_tokens (word, text)
tokens - tokens %> dplyr::filter(!word %in% stop_words $ word )
all_word_counts - tokens %>% group_by(book, chapter)%>%
count (word, sort = TRUE)%>% ungroup
all_word_counts_mat - all_word_counts %% spread (key=word, value=n, fill=0)
word_counts - all_word_counts_mat [["ring"]]
Plot the log-likelihood of the Poisson rate of usage of the word in word_counts. Then use word_counts
to compute the maximum likelihood estimate of the rate of the usage of the word in the LOTR. Mark
this maximum on the log-likelihood plot with a vertical line (use abline if you make the plot in base R or
geom_vline if you prefer ggplot).
image text in transcribed

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Databases On The Web Designing And Programming For Network Access

Authors: Patricia Ju

1st Edition

1558515100, 978-1558515109

More Books

Students also viewed these Databases questions

Question

LO2.6 Explain how the market system deals with risk.

Answered: 1 week ago