简体   繁体   中英

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

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

在此处输入图片说明

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM