问题描述
我正在尝试使用 GLM 对离散响应变量(范围为 0-20,000)和多个离散和分类解释变量进行建模,以 1) 为两个变量绘制回归线,以及 2) 根据模型。
我使用 fitdistrplus
包来标识要在 family
中使用的 glm()
。我发现与其他分布相比,伽玛分布的 AIC 最低(我的代码适用于使用来自 iris
的数据):
gamma.fit = fitdist(iris$Sepal.Length,"gamma",method = "mle")
gamma.fit$aic # get AIC
我如何调整它以尝试配电?
或者,我使用 poweRlaw
包来评估幂律分布(我的数据的自举 p 值表明该分布是一个选项)。
但是您如何提取 AIC,或者这甚至可以与我为 gamma 生成的 AIC 相媲美?
# make data discrete with rounding
power.fit = displ$new(round(iris$Sepal.Length,digits = 0))
pf.est = estimate_xmin(power.fit)$xmin # estimate xmin
power.fit$setXmin(pf.est) # append xmin to model
# estimate the distribution’s parameters using MLE
pf.alphahat = estimate_pars(power.fit)$pars
c(xmin = pf.est,alpha = pf.alphahat) # view parameters
所需的最终结果是基于任一分布生成 GLM:
my.model = glm(Sepal.Width ~ Sepal.Length,data = iris,na.action = 'na.omit',family = Gamma(link ="log")) # or power?
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)