我在试着找一个发行商。通过使用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
发布于 2015-02-17 13:41:51
鉴于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
NULLhttps://stackoverflow.com/questions/28552497
复制相似问题