簡體   English   中英

R 中的威布爾分布 (ExtDist)

[英]The Weibull distribution in R (ExtDist)

有人對使用ExtDist Package的 Weibull 分布有問題嗎?

文檔中:

具有未知形狀參數的分布的參數估計示例來自:Rinne (2009) 數據集 p.338 和示例 pp.418-419 參數估計的形狀為 99.2079,比例為 2.5957。 此數據和 Rinne 的參數估計值的對數似然為 -1163.278。

data <- c(35,38,42,56,58,61,63,76,81,83,86,90,99,104,113,114,117,119,141,183)
est.par <- eWeibull(X=data, method="numerical.MLE"); est.par
plot(est.par)

然而,當我運行它時,我得到以下 output:

Parameters for the Weibull distribution.
(found using the  numerical.MLE method.)

 Parameter  Type   Estimate       S.E.
     shape shape 5.82976007 1.79326460
     scale scale 0.06628166 0.02129258

這顯然是錯誤的,但我不確定我是否犯了錯誤,或者 package 中是否存在錯誤?

在我看來,這是 package 中的一個錯誤。我做了自己的獨立 MLE,並得到了與 Rinne 相同的答案:

library(bbmle)
m1 <- mle2(y~dweibull(shape=exp(lshape),scale=exp(lscale)),
     data=data.frame(y=data),
     start=list(lshape=0,lscale=0))

然后我深入研究並查看了dWeibull function 的來源:

function (x, shape = 2, scale = 2, params = list(shape = 2, scale = 2)) 
{
    if (!missing(params)) {
        shape <- params$shape
        scale <- params$scale
    }
    out = stats::dgamma(x, shape, scale)
    return(out)
}

似乎應該將out設置為dweibull(...)的結果而不是dgamma(...) ... ?? 查看weibull代碼的rest,這個錯誤似乎重復出現——也許這只是草率的剪切和粘貼? 我肯定會聯系維護者 ( maintainer("ExtDist") )。

附言。 如果我使用替代方法擬合 Gamma 分布,我會得到與ExtDist package 完全相同的答案:

m1g <- mle2(y~dgamma(shape=exp(lshape),rate=exp(lrate)),
     data=data.frame(y=data),
     start=list(lshape=0,lrate=0))
exp(coef(m1g))
##     lshape      lrate 
## 5.82976007 0.06628166 

錯誤影響了 eGamma 和 eWeibull 的代碼,但現在已修復(v0.7-1,2023 年 1 月 17 日)。 感謝 Robert Dodier 指點他們。

當前微博output:

# Parameter Estimation for a distribution with unknown shape parameters
# Example from: Rinne (2009) Dataset p.338 and example pp.418-419
# Parameter estimates are given as shape = 2.5957 and scale = 99.2079.
data <- c(35,38,42,56,58,61,63,76,81,83,86,90,99,104,113,114,117,119,141,183)
est.par <- eWeibull(X=data, method="numerical.MLE"); est.par

Parameters for the Weibull distribution. 
(found using the  numerical.MLE method.)

Parameter  Type Estimate      S.E.
    shape shape  2.59566 0.4366932
    scale scale 99.20792 9.0404336

# consistent with EnvStats estimates
EnvStats::eweibull(data)$parameters
    shape     scale 
 2.595663 99.207982 

eGamma當前output:

# Parameter estimation for a distribution with unknown shape parameters
# Example from:  Bury(1999) pp.225-226, parameter estimates as given by Bury are
# shape = 6.40 and scale=2.54.
data <- c(16, 11.6, 19.9, 18.6, 18, 13.1, 29.1, 10.3, 12.2, 15.6, 12.7, 13.1,
          19.2, 19.5, 23, 6.7, 7.1, 14.3, 20.6, 25.6, 8.2, 34.4, 16.1, 10.2, 12.3)
est.par <- eGamma(data, method="numerical.MLE"); est.par

Parameters for the Gamma distribution. 
(found using the  numerical.MLE method.)

Parameter  Type Estimate      S.E.
    shape shape 6.404003 1.7661637
    scale scale 2.544659 0.7300405

# consistent with EnvStats estimates
EnvStats::egamma(data)$parameters
    shape    scale 
 6.404041 2.544643 

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM