Hi R-users, I'm fitting gamma parameters (shape and rate ) by two methods (by direct and and fitdistr of MASS library). I have realized the following code which gives me two results. However, I find that those two outcomes are significantly different. Is there any explanation to this case? Many thanks in advance for your help
> param <- function(y) + + { + library(MASS) + + b <- subset(tab[!is.na(tab$DVTDR) & (tab$DVTDR > 0),], IDAV<= y ) + + z <- b$DVTDR + + m <- mean(z) + + v <- var(z) + + para1 <- list(shape = m^2/v, rate = m/v) + + para2 <- fitdistr(z, "gamma") + + return(list(para1,para2)) + + } > > param("321") [[1]] [[1]]$shape [1] 1.603642 [[1]]$rate [1] 1.286430 [[2]] shape rate 1.81991260 1.45992004 (0.02503046) (0.02309113) ## Lassana KOITA E-mail: [EMAIL PROTECTED] http://www.stac.aviation-civile.gouv.fr/ [[alternative HTML version deleted]] ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.