【问题标题】:mledist for Pareto distribution帕累托分布的 mledist
【发布时间】:2015-02-17 13:41:50
【问题描述】:

我正在寻找一个发行版。通过使用 mledist 功能。但是每次我使用它时都会发现一条错误消息:

[1] "Error in optim(par = vstart, fn = fnobj, fix.arg = fix.arg, obs = data,  : \n  non-finite finite-difference value [2]\n"
attr(,"class")
[1] "try-error"
attr(,"condition")
<simpleError in optim(par = vstart, fn = fnobj, fix.arg = fix.arg, obs = data,     ddistnam = ddistname, hessian = TRUE, method = meth, lower = lower,     upper = upper, ...): non-finite finite-difference value [2]>

问题是我知道,“Alae”有一个帕累托分布,但我不明白我的错误在哪里。请帮忙:) 这是我的代码

library(fitdistrplus)
library(CASdatasets)
data(lossalae)
pertes<-lossalae
Alae <- pertes$ALAE   
Alae_par <- mledist(Alae, 'pareto',start=c(shape=5,scale=2))

TNX

【问题讨论】:

  • 我得到一个不同的错误:“mledist 中的错误(Alae, "pareto", start = c(shape = 5, scale = 2)) : The dpareto function must be defined"

标签: r distribution pareto-chart


【解决方案1】:

鉴于 CASdatasets 的来源是一位加拿大保险作者,我猜测 dpareto-function 应该来自 pkg:actuar:

> library(actuar)

Attaching package: ‘actuar’

The following object is masked from ‘package:grDevices’:

    cm

> library(fitdistrplus)
> library(CASdatasets)
> data(lossalae)
> pertes<-lossalae
> Alae <- pertes$ALAE   
> Alae_par <- mledist(Alae, 'pareto',start=c(shape=5,scale=2))
Warning messages:
1: In dpareto(c(3806L, 5658L, 321L, 305L, 758L, 8768L, 1805L, 78L,  :
  NaNs produced
snipped 6 other warnings

> Alae_par
$estimate
       shape        scale 
    2.221351 15106.971534 

$convergence
[1] 0

$loglik
[1] -15413.45

$hessian
             shape         scale
shape 303.98838362 -3.083551e-02
scale  -0.03083551  3.637979e-06

$optim.function
[1] "optim"

$fix.arg
NULL

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-03-15
    • 1970-01-01
    • 2021-06-26
    • 1970-01-01
    • 2021-04-19
    • 1970-01-01
    相关资源
    最近更新 更多