首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >错误代码100在r中使用fitdist拟合gamma3分布(参数列表错误)

错误代码100在r中使用fitdist拟合gamma3分布(参数列表错误)
EN

Stack Overflow用户
提问于 2021-07-14 09:51:26
回答 1查看 32关注 0票数 0

我正在尝试拟合我的数据的多个分布,以找到最适合的,从库( fit Fitdistrplus)中找到最佳匹配。我使用库中的dgamma3 (FAdist)。如何为每个分发设置start参数?

代码语言:javascript
复制
library(FAdist)
library(fitdistrplus)
x <- rnorm(30,5,1)
fitdist(x, distr = 'gamma3',start = list(meanlog=0,sdlog=1))

下面是错误:

代码语言:javascript
复制
$start.arg
$start.arg$meanlog
[1] 0

$start.arg$sdlog
[1] 1


$fix.arg
NULL

Error in checkparamlist(arg_startfix$start.arg, arg_startfix$fix.arg,  : 
  'start' must specify names which are arguments to 'distr'.

修改于2021/7/15:我更改了参数列表,仍然得到错误。我使用的是库: FAdist,fitdistrplus

代码语言:javascript
复制
x <- rgamma3(30, shape = 1, scale = 1, thres = 0)
fitdist(x, distr = 'gamma3', start = list(shape = 1, scale = 1, thres = 0)) 

[1] "gamma3"
$start.arg
$start.arg$shape
[1] 1

$start.arg$scale
[1] 1

$start.arg$thres
[1] 0


$fix.arg
NULL
Error in checkparamlist(arg_startfix$start.arg, arg_startfix$fix.arg, : 'start' must specify names which are arguments to 'distr'.
EN

回答 1

Stack Overflow用户

发布于 2021-07-14 14:52:34

您的初始参数列表(start)需要具有与dgamma3函数相对应的名称。从文档中:

代码语言:javascript
复制
dgamma3(x,shape=1,scale=1,thres=0,log=FALSE)

所以,

代码语言:javascript
复制
fitdist(x, 'gamma3', start=list(shape=1,scale=1, thres=0))
票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/68371096

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档