GLM和准Poisson

3
我希望使用quasipoisson作为family参数,运行glm()。但是我已经有了很好的离散度参数phi 的估计值,因此希望在应用glm()时使用该值。是否有一种方法可以强制glm使用给定的离散度参数来进行quasipoisson拟合?
2个回答

5
散度参数仅与推断有关,而不是参数优化。因此,在summary.glm中存在相应的参数。
counts <- c(18,17,15,20,10,20,25,13,12)
outcome <- gl(3,1,9)
treatment <- gl(3,3)

glm.po <- glm(counts ~ outcome + treatment, family = poisson())

summary(glm.po)$coef
#                 Estimate Std. Error       z value     Pr(>|z|)
#(Intercept)  3.044522e+00  0.1708987  1.781478e+01 5.426767e-71
#outcome2    -4.542553e-01  0.2021708 -2.246889e+00 2.464711e-02
#outcome3    -2.929871e-01  0.1927423 -1.520097e+00 1.284865e-01
#treatment2   1.337909e-15  0.2000000  6.689547e-15 1.000000e+00
#treatment3   1.421085e-15  0.2000000  7.105427e-15 1.000000e+00

glm.qu <- glm(counts ~ outcome + treatment, family = quasipoisson())

summary(glm.qu)$dispersion
#[1] 1.2933
summary(glm.qu)$coef
#                 Estimate Std. Error       t value     Pr(>|t|)
#(Intercept)  3.044522e+00  0.1943517  1.566502e+01 9.698855e-05
#outcome2    -4.542553e-01  0.2299154 -1.975750e+00 1.193809e-01
#outcome3    -2.929871e-01  0.2191931 -1.336662e+00 2.522944e-01
#treatment2   1.337909e-15  0.2274467  5.882297e-15 1.000000e+00
#treatment3   1.421085e-15  0.2274467  6.247992e-15 1.000000e+00

summary(glm.qu, dispersion=1)$coef
#                 Estimate Std. Error       z value     Pr(>|z|)
#(Intercept)  3.044522e+00  0.1708987  1.781478e+01 5.426767e-71
#outcome2    -4.542553e-01  0.2021708 -2.246889e+00 2.464711e-02
#outcome3    -2.929871e-01  0.1927423 -1.520097e+00 1.284865e-01
#treatment2   1.337909e-15  0.2000000  6.689547e-15 1.000000e+00
#treatment3   1.421085e-15  0.2000000  7.105427e-15 1.000000e+00

1

从R的stats::family帮助页面中:

Arguments:
...
variance: for all families other than ‘quasi’, the variance function is
          determined by the family.  The ‘quasi’ family will accept the
          literal character string (or unquoted as a name/expression)
          specifications ‘"constant"’, ‘"mu(1-mu)"’, ‘"mu"’, ‘"mu^2"’
          and ‘"mu^3"’, a length-one character vector taking one of
          those values, or a list containing components ‘varfun’,
          ‘validmu’, ‘dev.resids’, ‘initialize’ and ‘name’.

假设您对方差/均值系数的估计值为1.2,
glm(..., family=quasipoisson(variance="1.2*mu"))

将会完成工作。

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接