xmp06.13 {Devore5}R Documentation

data from Example 6.13

Description

The xmp06.13 data frame has 420 rows and 1 columns of the number of goals pre game scored by National Hockey League teams during the 1966-1967 season.

Format

This data frame contains the following columns:

goals
a numeric vector

Source

Devore, J. L. (2000) Probability and Statistics for Engineering and the Sciences (5th ed), Duxbury

Reep, C. and Pollard, R. and Benjamin, B. (1971), ``Skill and chance in ball games'', Journal of the Royal Statistical Society, Series A, General, 134, 623–629

Examples

data(xmp06.13)
attach(xmp06.13)
table(goals)      # compare to frequency table on p. 267
hist(goals, breaks = 0:12 - 0.5, las = 1, col = "lightgray")
negBinom.MoM <- function(x) {
   ## method of moments estimates for negative binomial distribution
   xbar <- mean(x)
   mnSqDev <- mean((x - xbar)^2)
   c(p = xbar/mnSqDev, r = xbar^2/(mnSqDev - xbar))
}
print(goals.MoM <- negBinom.MoM(goals))
## MLE's
optim(goals.MoM, function(x)
  -sum(dnbinom(goals, p = x[1], size = x[2], log = TRUE)))
## would have been better to use a transformation of p
detach()