【问题标题】:Error with fitting a Generalized Extreme Value (GEV) using `extRemes` in R?在 R 中使用“extRemes”拟合广义极值 (GEV) 时出错?
【发布时间】:2019-09-01 09:03:41
【问题描述】:

我有一些数据,我想在 R 中使用 extRemes 包拟合广义极值 (GEV) 分布。但是,出现错误:

library(extRemes)
Mydata = c(6,3,3,3,5,5,4,3,5,5,4,3,4,4,6,5,5,4,5,2,6,4,6,5,3,3,8,3,4,4,6,6,6,6,6,5,6,6,5,5)
fit_gev <- fevd(x=Mydata, method = "MLE", type="GEV", period.basis = "year")
summary(fit_gev)

Error in diag(cov.theta) : invalid 'nrow' value (too large or NA)
In addition: Warning message:
In diag(cov.theta) : NAs introduced by coercion

我想知道如何解决这个错误?感谢您的帮助。

【问题讨论】:

    标签: r data-fitting


    【解决方案1】:

    您可以使用 EnvStats 包进行如下调整:

    library(EnvStats)
    # Data
    Mydata =
    c(6,3,3,3,5,5,4,3,5,5,4,3,4,4,6,5,5,4,5,2,6,4,6,5,3,3,8,3,4,4,6,6,6,6,6,5,6,6,5,5)    
    # Generalized Extreme Value (EnvStats)
    egevd(Mydata, method = "pwme")# (Method: probability-weighted moments)
    
    Results of Distribution Parameter Estimation
    --------------------------------------------
    
    Assumed Distribution:            Generalized Extreme Value
    
    Estimated Parameter(s):          location = 4.268896
                                     scale    = 1.314489
                                     shape    = 0.353434
    
    Estimation Method:               Unbiased pwme
    
    Data:                            Mydata
    
    Sample Size:                     40
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2014-04-05
      • 1970-01-01
      • 1970-01-01
      • 2017-11-26
      • 1970-01-01
      • 2019-09-12
      • 1970-01-01
      相关资源
      最近更新 更多