Search code examples
rdistributionweibull

How to fit Weibull distribution using “MME” method and find the estimates in R


I am trying to fit a Weibull distribution in R using MME method and find the estimates. Below is the code used to fit the weibull distribution in R from the fitdistrplus and actuar package.

a <- rweibull(100, 10,1)
weibul_mme <- mmedist(a, "weibull", order = 1:2)

But I am getting the below error

Error in mmedist(a, "weibull", order = 1:2) : 
  the empirical moment function must be defined

It would be helpful if anyone can tell me what mistake I am making or provide some reading material for the same


Solution

  • R code below, Microsoft R Open 3.5.3 x64, Win 10

    library(fitdistrplus)
    library(actuar)
    
    x <- rweibull(1000, 10,1)
    
    memp <- function(x, order) mean(x^order)
    
    weibul_mme <- mmedist(x, "weibull", order = 1:2, memp=memp)
    fit.weibull<- fitdist(x, "weibull", method = "mme", order=c(1, 2), memp=memp, lower = c(0, 0))
    
    print(weibul_mme)
    print(fit.weibull)
    
    plot(fit.weibull, demp=TRUE)
    

    produced reasonable fit using MME method

    enter image description here