简体   繁体   English

将逆高斯分布拟合到R中的数据

[英]fitting an inverse gaussian distribution to data in R

Im trying to use the fitdist function in R to fit data to three different distributions by maximum likelihood to compare them. 我试图在R中使用fitdist函数通过最大可能性将数据拟合为三个不同的分布,以将它们进行比较。 Lognormal and Weibull work fine, but I am struggling with Inverse Gaussian. 对数正态和Weibull可以很好地工作,但是我在逆高斯方面苦苦挣扎。 I need to specify starting values, however when I do I get an error message. 我需要指定起始值,但是当我收到错误消息时。

fw<-fitdist(claims,"weibull") WORKS
fln<-fitdist(claims,"lnorm") WORKS
fig<-fitdist(claims,"invgauss",start=list(mu=0,lambda=1)) DOES NOT WORK

Error: 'The pinvgauss function should return a zero-length vector when input has length zero and not raise an error' 错误:“当输入的长度为零且未引发错误时,pinvgauss函数应返回零长度的矢量”

What is wrong with my code? 我的代码有什么问题?

I was working with a similar issue and found the issue was with how I labeled my start values. 我正在处理类似的问题,发现问题在于我如何标记我的起始值。 The actuar library I was working with required the labels "mean" and "shape" on the values. 我正在使用的执行器库在值上需要标签“ mean”和“ shape”。 The following code provided me a solution: 以下代码为我提供了解决方案:

library(actuar)
library(fitdistrplus)
fig <- fitdist(claims, "invgauss", start = list(mean = 5, shape = 1))

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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