使用glmulti拟合准家族? [英] fitting quasi family using glmulti?
问题描述
我使用了glmulti
包中的glmulti
函数来为泊松误差分布数据获得最佳的glm模型.那里没有问题.一旦获得最佳模型,就可以使用卡方检验来获得p值,并对输入模型的每个变量进行检验统计.我遇到的唯一问题是数据过于分散,Zuur书和Crawley都建议使用准族函数来校正过度分散.除了glmulti函数不允许拟合准函数外,这本身不是问题.
I used the glmulti
function in the glmulti
package to obtain the best glm model for poisson error distributed data. No problems there. Once I had obtained the best model, I used the Chi-square test to obtain p-values and test statistics for each of the variables entered into the model. The only problem I am encountering is that the data is overdispersed and the Zuur book and Crawley both suggest using the quasi family function to correct for overdispersion. This in itself is not a problem except that the glmulti function does not allow fits to quasi functions.
我的问题是,是否可以使用具有泊松误差分布的glmulti获取我的最佳模型,然后将最佳模型输出拟合为准函数,这是做事的不正确方法,并且如果还有其他建议,那么任何人都可以提供.
The question I have, is whether obtaining my best model using glmulti with a poisson error distribution and then fitting the best model output to a quasi function is the incorrect way to go about doing things and if there are any other suggestions anyone could offer.
我还运行了正态分布数据的glmulti(将家庭指定为高斯,将链接指定为身份),这确实可行,但是如果我违反任何主要规则,请告诉我.
I also ran glmulti for normally distributed data (specifying family as gaussian and link as identity) and this did work, but if I am violating any major rules, please do let me know.
推荐答案
另一个建议的问题是"qaic
"在glmulti
中似乎不起作用.
对于我来说,这可行:
Problem with the other answer that was suggested is that "qaic
" doesn't seem to work in glmulti
.
For me this worked though:
library(bbmle)
qaicmod = function (fit) qAIC(fit, dispersion=with(fit,sum((weights * residuals^2)[weights > 0])/df.residual) )
glmulti.out <- glmulti(XXX model formula XXX,
data = mydata,crit = "qaicmod",
confsetsize = 5, fitfunction = "glm",
family = poisson)
这使用常规的泊松GLM,但会基于估计的色散系数来计算QAIC. 在qaicmod函数的色散参数中,您还可以将包括所有变量在内的完整拟泊松GLM的估计色散系数(我见过一些统计数据建议这样做),即代替
This uses a regular poisson GLM but calculates the QAIC based on the estimated dispersion coefficient. In the dispersion argument of the qaicmod function you could also put the estimated dispersion coefficient of a full quasipoisson GLM with all variables included (some statisticions I have seen recommend this), i.e. to use instead
disp <<- summary(fullmodel)$dispersion
qaicmod = function (fit) qAIC(fit, dispersion=disp)
这篇关于使用glmulti拟合准家族?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!