Mosteller and Wallace give the frequencies, nk, of counts k = 0, 1, … of other selected marker words in 247 blocks of text known to have been written by Alexander Hamilton. The data below show the occurrences of the word upon, that Hamilton used much more than did James Madison.

> count <- 0:5

> Freq <- c(129, 83, 20, 9, 5, 1)

(a)Read these data into R and construct a one-way table of frequencies of counts or a matrix or data frame with frequencies in the first column and the corresponding counts in the second column, suitable for use with goodfit ().

head(Xy.tab)
## count
##   0   1   2   3   4   5 
## 129  83  20   9   5   1

(b)Fit and plot the Poisson model for these frequencies.

PoisModel.fit <- goodfit(Xy.tab, type = "poisson")
plot(PoisModel.fit, type = "standing", xlab="count", main = "Poisson Model")

(c)Fit and plot the negative binomial model for these frequencies.

PoisModel.fit1 <- goodfit(Xy.tab, type = "nbinomial")
plot(PoisModel.fit1, type = "standing", xlab="count", main = "Negative Binomial Model")

(d)What do you conclude?

We can observe and conclude that the actual value has a significant number of deviations.