xmp06.12 {Devore5} | R Documentation |
The xmp06.12
data frame has 20 rows and 1 columns of data on
the survival times of mice subjected to radiation.
This data frame contains the following columns:
Devore, J. L. (2000) Probability and Statistics for Engineering and the Sciences (5th ed), Duxbury.
Gross, A. J. and Clark, V. (1976) Survival Distributions: Reliability Applications in the Biomedical Sciences, Wiley.
data(xmp06.12) attach(xmp06.12) gamma.MoM <- function(x) { ## calculate method of moments estimates for gamma distribution xbar <- mean(x) mnSqDev <- mean((x - xbar)^2) c(alpha = xbar^2/mnSqDev, beta = mnSqDev/xbar) } ## method of moments estimates print(surv.MoM <- gamma.MoM(Survival)) ## evaluating the negative log-likelihood gammaLlik <- function(x) { ## argument x is a vector of shape (alpha) and scale (beta) -sum(dgamma(Survival, shape = x[1], scale = x[2], log = TRUE)) } ## maximum likelihood estimates - use MoM estimates as starting value MLE <- optim(par = surv.MoM, gammaLlik) print(MLE) detach()