楼主: mooonlight
4969 1

[学习分享] 广义线性混合模型 过度离散怎么解决 [推广有奖]

  • 1关注
  • 1粉丝

讲师

43%

还不是VIP/贵宾

-

威望
0
论坛币
0 个
通用积分
0.0096
学术水平
1 点
热心指数
1 点
信用等级
1 点
经验
8074 点
帖子
210
精华
0
在线时间
295 小时
注册时间
2012-12-6
最后登录
2025-8-7

楼主
mooonlight 发表于 2014-10-24 09:48:17 |AI写论文

+2 论坛币
k人 参与回答

经管之家送您一份

应届毕业生专属福利!

求职就业群
赵安豆老师微信:zhaoandou666

经管之家联合CDA

送您一个全额奖学金名额~ !

感谢您参与论坛问题回答

经管之家送您两个论坛币!

+2 论坛币
   一般线性混合模型的里面的过度离散用quasi就可以解决,但是这个在GLMM里面不适用,关于GLMM有2个问题求助一下
1  怎么判断 GLMM模型存在过度离散
2 如果存在,该怎么解决了
先谢谢了
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

关键词:混合模型 Quasi GLMM 怎么判断 MM模型 模型

沙发
DM小菜鸟 发表于 2014-12-29 17:52:33
我给你翻到一个英文的文档,叫“How can I test for overdispersion/compute an overdispersion factor?”,说得算是清楚的了。不妨看一看,另外,这里还有一个例子,可以copy一下——


How can Itest for overdispersion/compute an overdispersion factor?  

  • with the usual caveats, plus a few extras —     counting degrees of freedom, etc. — the usual procedure of calculating the     sum of squared Pearson residuals and comparing it to the residual degrees     of freedom should give at least a crude idea of overdispersion. The     following attempt counts each variance or covariance parameter as one     model degree of freedom and presents the sum of squared Pearson residuals,     the ratio of (SSQ residuals/rdf), the residual df, and the p-value based on     the (approximately!!) appropriate χ2 distribution. Do PLEASE note the usual, and extra,     caveats noted here: this is an APPROXIMATE estimate of an overdispersion     parameter. Even in the GLM case, the expected deviance per     point equaling 1 is only true as the distribution of individual deviates     approaches normality, i.e. the usual λ>5 rules of thumb for Poisson     values and min(Np,N(1−p))>5 for binomial values (e.g. see Venables and Ripley MASS p.     209). (And     that's without the extra complexities due to GLMM, i.e. the     "effective" residual df should be large enough to make the sums     of squares converge on a χ2 distribution …)
   
overdisp_fun <- function(model) {
  ## number of variance parameters in
  ##   an n-by-n variance-covariance matrix
  vpars <- function(m) {
    nrow(m)*(nrow(m)+1)/2
  }
  model.df <- sum(sapply(VarCorr(model),vpars))+length(fixef(model))
  rdf <- nrow(model.frame(model))-model.df
  rp <- residuals(model,type="pearson")
  Pearson.chisq <- sum(rp^2)
  prat <- Pearson.chisq/rdf
  pval <- pchisq(Pearson.chisq, df=rdf, lower.tail=FALSE)
  c(chisq=Pearson.chisq,ratio=prat,rdf=rdf,p=pval)
}

这个例子是——

library(lme4)  ## 1.0-4
set.seed(101)  
d <- data.frame(y=rpois(1000,lambda=3),x=runif(1000),
                f=factor(sample(1:10,size=1000,replace=TRUE)))
m1 <- glmer(y~x+(1|f),data=d,family=poisson)
overdisp_fun(m1)
##        chisq        ratio          rdf            p
## 1026.7780815    1.0298677  997.0000000    0.2497659
library(glmmADMB)  ## 0.7.7
m2 <- glmmadmb(y~x+(1|f),data=d,family="poisson")
overdisp_fun(m2)
##        chisq        ratio          rdf            p
## 1026.7585031    1.0298480  997.0000000    0.2499024
The gof function in the aods3 package works for recent (development) versions of the lme4 package — it provides essentially the same set of information.

您需要登录后才可以回帖 登录 | 我要注册

本版微信群
加好友,备注cda
拉您进交流群
GMT+8, 2025-12-31 00:02