Question: The negative binomial distribution can be generalised for r E (0, co) (ie. non- integer values) by expressing the choose function in terms of gamma

The negative binomial distribution can be generalised for r E (0, co) (ie. non- integer values) by expressing the choose function in terms of gamma functions: T(k+r) f ( k|r, p) = T(k + 1)I(r) p* (1 - p). Here & is a non-negative integer. Consider iid X1, ..., Xion ~ NBin(r, p). There is no closed-form expression for the MLE of (r, p). (a) Write R code to calculate the negative log-likelihood for (r, p), given values of X1, ..., Xion. (Hint: Use the R function debinom with size = r and prob = 1 - p.) (b) Write R code to generate values of X1, ..., Xion with r = 2 and p = 0.8. Evaluate MLE estimates (r, p) numerically using the mle function in the stats4 package. (c) Simulate 1000 such data sets and evaluate MLE estimates of (r, p) for each one. Summarize your results with a scatterplot of points (r, p) and separate histograms for f and p
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
