编辑2 27/7:我发现,如果将色散参数设置为0.64,则必须获得正确的输出。
我尝试用
summary(fit, dispersion = 0.64)
但这不起作用。可能是因为它是带有汇总估算值的推算数据集。它确实可以在没有插补的情况下在数据集中工作。有人知道如何重写此行,以便它在合并的数据集中工作吗?
编辑26/7:我已经设法在示例数据中找到解决方案:
gamma.shape(fit)
summary(fit, dispersion = gamma.dispersion(fit))
summary(fit, dispersion=1/gamma.shape(fit)$alpha)
最后一行再现与SPSS类似的S.E.和p值。但是,当我尝试在合并的数据集中使用相同的方法时,它不起作用。这是我得到的错误:
gamma.shape(fit)
Error in -y : invalid argument to unary operator
> gamma.shape(pool(fit))
Error in UseMethod("gamma.shape") :
no applicable method for 'gamma.shape' applied to an object of class
"c('mipo', 'data.frame')"
>
有关如何解决此问题的任何线索?
我在使用R时遇到了一些困难。我之前在这里发布了一个问题,这使我走得更远,但又引出了另一个问题:
是否可以在R中更改比例参数方法?我正在执行带有伽马对数链接的GLM,但是R和SPSS之间的估计S.E.,置信区间和p值不同。我想在R中复制确切的SPSS发现,但我不知道怎么做。
我的原始数据集是一个估算的数据集(mids对象,使用MICE程序包创建)。为简化起见,我创建了一个数据量较少的示例数据集:
##样本数据
F <- structure(list(HbA1c = c(69, 75, 62, 96, NA, 86, 44, 49, NA, 63, 43, 75, 48, 56, 79, 78, 67, 66, 75, 67, 65, 66, 34, 62, 79, 60, 91, 51, 84, 72, 65, NA, NA, 62, 61, 69, 63, NA, 85, 38, 42, 80, 59, 96, 59, 49, 62, 98, 71, 78, 50, 43, 44, 69, 56, 38, 59, 74, 115, 69, 67, 51, NA, 107, 71, 86, 78, 41, 60, 59, 74, 73, 49, 34, 71, 57, 55, 74, 67, 61, 48, 59, 70, NA, 55, 72, 69, 82, 40, 58, NA, 53, 46, 69, 60, 39, 76, 69, 61, 86, 58, 63, 66, 103, 73, 54, 59, 46, 58, 70, 57, 53, 49, 53, 58, 71, 60, 76, 64, 97, 60, 49, 53, 44, 53, 73, 59, 75, 61, 55, 68, 56, 51, 91, 92, 76, 51, 55, 61, 83, 52, 62, 71, 75, 54, 64, 90, 65, NA, 69, 70, 70, 59, 62, 60, 63, 58, 58, 63, 60, 49, 62, 95, 42, 99, 67, 117, 68, 55, 55, 70, 60, 61, 91, 33, 89, 60, 47, 62, 72, 40, 88, 59, 56, 57, 59, 74, 41, 53, 76, 48, 73, 65, 96, 58, 55, 67, 45, 45, 69, 72, 44, 59, 43, 90, 69, 69, 71, 93, 42, 87, 54, 83, 60, 48, NA, 53, 56, 57, 77, 63, NA, 63, 60, 68, 51, 48, 65, 61, 79, 63, 62, 53, 67, 53, 53, 63, 55, 61, 51, 53, 46, NA, 78, 76, 73, 51, 49, 68, 86, 71, 55, 57, 113, 63, 68, 94, NA, 38, 50, NA, 42, 60, 57, 49, 60, 81, 69, 55, 82, 64, 55, 74, 71, 56, 60, NA, 47, 49, 98, 55, 80, 71, 69, 35, 53, 90, 64, 82, 132, 64, 70, 65, 34, 65, 54, NA, 68, 58, 76, 82, 66, 74, 66, NA, 54, 53, 78, 62, 88, 69, 49, 83, 54, 55, 56, 66, 84, 47, 82, 53, 62, 163, 41, 55, 89, 76, 81, 45, 50, 89, 72, 90, 47, 38, 83, NA, 53, 74, 55, 47, 49, 56, 74, 107, 86, 48, 59, 86, 44, 55, 64, 81, 66, 63, 98, 51, NA, 60, 50, 55, 52, 79, 58, 50, 89, NA, 36, 50, 70, NA, 86, 57, 60, 78, 53, 70, 79, 49, 78, 83, 66, 57, 62, 80, 70, NA, 67, 80, 46, 79, 47, 145, 87, 53, 65, 73, 75, 53, 50, 71, NA, 65, 106, 123, 51, 55, 43, 48, 86, 61, 64, 55, 71, 61, 96, 80, 69, 66, 74, 88, 48, 68, 55, 52, 58, 69, 66, 44, 45, 64, 84, 72, 49, NA, 71, 70, 104, 78, 73, 47, 75, 45, 57, 88, 86, 55, 72, 47, 53, 113, 62, 54), BMI = c(26.7, 34.5, 24.3, NA, 19.1, 37.9, 29.1, 27.1, NA, 21.1, 48.5, 26.2, 26.9, NA, 25.5, 25.3, 44.3, 25.2, 26.7, NA, 25.5, 25.9, 31.2, 33, 21.8, 23.7, 32, 23.6, 32.4, 29.7, NA, 22.9, 24.4, 33.9, 35.4, 41.2, 20.4, NA, 30.1, 21, NA, NA, 29.5, 16.6, 38.1, 23.9, 19.1, 35.4, 24.2, NA, 26.1, 20, 28.7, 30.7, 25.4, 29.6, 25.4, 26.2, 18.3, 31, NA, NA, 31.5, 32, 35.6, 24.3, 33.3, 35.5, NA, 24.1, NA, 33.4, 28.4, NA, 25.9, 26.7, 35.5, 31.6, 25, 25.5, 22.2, 22.3, 23.4, 35.3, 26.1, 32.6, 20.9, 35.9, 29.1, 32.8, 32.2, 28.9, 28.9, 28.8, 19.7, 29.4, 28.8, 28.2, 20.9, 33.5, 17.6, 38.6, 27.1, NA, 29, 25.6, 22.5, 30.6, 35.6, 32.5, 23.4, 27.2, 23.6, 26.6, 23.5, 30.3, 30.6, 26.4, 38.1, 34.7, NA, 24.6, 22.2, 39.8, 23, 35.8, 31.4, 22.8, 29.3, 27, 31.1, NA, NA, 32.4, 36, NA, 52.8, 22, 27.1, 23.3, 22.7, 25, 42.6, 30.2, 25.3, 30.5, 25.3, 28.4, 30.1, 32.4, NA, 32, 18.8, 23.1, 28.5, 25.1, 22.8, 23.6, 18.5, NA, 27.1, 25.3, 19.8, 20.8, 32.7, 30.1, 34.8, 37.5, NA, 28.1, 46, 23.5, 26.3, 22.2, 28.2, 29.3, 24.2, 29.7, 28.9, 28, 31.3, 28.6, 29.1, 28.4, 23.1, 34.9, 22.7, 26.9, 28.9, 35.9, 23, 25.8, 22.8, 19.2, 27.9, 29.2, 35, 25.1, 20.5, 23.9, 34.3, 23.1, 25.1, 20.5, 24.6, 24.4, 23.7, 22.4, 40.1, 21.9, 50, 34.2, 30.5, 20.7, 29.3, 32.6, 32.1, 23.9, NA, 34, 22.6, 30.2, 28.6, 27.5, 33, 24, 28.8, NA, 32.8, 21.8, NA, 37.8, 26.4, 36.2, 20.8, 24.4, 31, 31.9, 27.6, 25.4, 22.7, NA, 27.7, 32.4, 34, 26.2, 26.7, 23.7, 32, 24.1, 35.8, 23.5, 38.9, 35.3, NA, 23.9, 30.2, 24.4, 24.4, 27.9, NA, 25.7, 25.6, 25.8, 47.9, 25.6, 36.1, NA, 24.2, 24.8, 21.4, 22.3, 24.3, 24.7, 22.5, 25.9, 30.1, 27.4, 27.8, 22.6, 24.4, NA, 33.8, 41.9, 21.4, 32.5, 41.1, 27.2, NA, 37.8, 29, 23.2, 28.7, 25.2, 32.6, 29, 24.4, 23.1, 22.8, 23.1, 39.8, 26.6, 25.3, 53.5, 25, 22.9, 22.2, 30.2, 27.4, 27.4, NA, 25.2, 22.4, 20.2, 23.9, 23.3, 31.2, 24, 23.5, 38.8, 30, 30.6, 28.9, 23.1, 34.4, 28.7, 30.8, 21.6, 24.1, 25.5, 39.2, 29.3, 36.2, 28.3, NA, NA, NA, 29.5, 33.1, 23.4, 23.5, 25.1, 34.4, 24.5, 29.7, 22.2, 25.5, 23.3, 37.5, 26.8, 44.5, 32.4, 26.1, 21.4, 26.5, 32.7, 26.9, NA, 27.4, 36.3, 25.1, 37.7, NA, 27.6, 24.2, 46.9, 30.8, 29.3, 25.4, 35.7, 36.8, 35, 22.3, 28.3, 20.4, 25, 35, NA, 39.4, 25.2, 22.5, 34.5, NA, 21.6, 30.1, 25, NA, 28.3, 19.7, 22.3, 33.2, NA, 24.6, 23.9, 22.8, 24.1, 31.7, 28.4, 34.5, 30.1, 33.3, 28, 38, 35.9, 30.6, 33.5, 29.5, 21.4, 24.4, 27.5, 31.7, 23.8, NA, 21.8, 28.7, 33.5, 23.5, 27.3, 28.7, NA, 25.6, 26.7, 44.8, 26.2, 27.1, 39.7, 24.1, 21.3, 29.5, 30, NA, 27, NA, 23.6, 22.3, 32.6, 51.9, 27.7, 28.7, 35.2, 27.2, 29.6, 22.8, 19.6, 25.7, 28.3, 31.2, 21.7, 36.2, 26.9, 37.9, 21.5, 25.4),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 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 1, 1, NA, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 1, 0, NA, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, NA, NA, 0, 0, 0, 1, 1, 0, 0, 0, 1, 1, 0, 0, 0, NA, 0, NA, 0, 0, 0, 0, NA, 0, NA, 0, 0, 0, 0, 0, 0, 0, 0, 0, NA, 1, 1, 1, 0, 1, NA, NA, 0, 1, 0, 0, 1, 1, NA, 0, 0, 0, 1, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, NA, 0, 0, 0, 0, 0, 0, 1, NA, 0, 0, NA, 0, 0, 0, 0, 0, 1, NA, 0, 1, 1, 0, 0, NA, 0, 0, 1, 1, 0, 0, 0, NA, 0, 1, 0, 0, 0, 0), totaalhealthcareutilization = c(15, 15, 6, 52, 12, 5, 13, 15, 13, 8, 10, 4, 9, 8, 6, 5, 8, 42, 15, 21, 6.3, 9, 5, 5, 14, 24, 8, 15, 25, 12, 29, 21, 6, 11, 8, 7, 29, 7, 7, 19, 14, 25, 16, 7, 20, 13, 17, 12, 5, NA, 9, 11, 14, 57, 12, 10, 37, 8, 12, 57, 8, 11, 14, 11, 49, 10, 10, 11, 19, 20, 21, 5, 1, 2, 2, 3, 3, 6, 4, 3, 4, 6, 5, 4, 4, 5, 7, 6, 6, 8, 5, 7, 8, 5, 6, 6, 6, 8, 7, 6, 6, 9, 11, 7, 9, 7, 7, 7, 7, 8, 10, 10, 10, 9, 9, 9, 11, 8, 10, 9, 9, 11, 13, 8, 12, 12, 9, 11, 7, 8, 10, 10, 9, 10, 10, 12, 12, 16, 9, 5, 10, 7, 13, 13, 13, 15, 16, 11, 11, 17, 13, 12, 22, 19, 15, 14, 11, 12, 19, 13, 15, 13, 14, 11, 17, 12, 17, 10, 13, 15, 12, 13, 13, 20, 16, 21, 17, 25, 22, 18, 18, 17, 15, 19, 10, 15, 20, 33, 22, 26, 23, 27, 20, 21, 21, 13, 24, 45, 27, 27, 19, 19, 25, 43, 16, 16, 13, 24, 29, 17, 24, 25, 32, 27, 29, 22, 35, 56, 26, 45, 23, 54, 26, 33, 23, 39, 35, 24, 36, 37, 37, 74, 53, 36, 60, 33, 35, 26, 44, 78, 22, 26, 77, 62, 121, 51, 28, 68, 63, 43, 64, 81, 120, 95, 98, 23, 11, 21, 10, 7, 41, 7, 33, 6, 40, 20, 2, 31, 23, 23, 13, 68, 9, 8, 41, 19, 27, 29, 46, NA, 35, 16, 12, 9, 14, 20, 7, 2, 4, 6, 6, 6, 4, 9, 6, 8, 9, 12, 9, 7, 8, 12, 11, 11, 14, 12, 14, 12, 16, 15, 22, 23, 19, 11, 12, 13, 17, 18, 19, 27, 15, 9, 17, 18, 19, 17, 19, 12, 16, 54, 21, 30, 23, 25, 24, 37, 35, 27, 47, 22, 27, 27, 30, 32, 32, 31, 39, 28, 36, 54, 50, 45, 42, 88, 56, 63, 82, 60, 70, 139, 122, 71, 130, 84, 33, 111, 111, 246, 157, 54, 24, 41, 22, 7, 33, 15, 9, 6, 16, 67, 3, 22, 48, 15, 57, 25, 48, 74, 40, 25, 18, 21, 3, 6, 7, 7, 14, 9, 11, 16, 14, 14, 14, 28, 18, 22, 21, 26, 39, 24, 22, 18, 22, 19, 19, 45, 15, 13, 22, 31, 29, 46, 37, 23, 35, 68, 39, 51, 35, 50, 80, 69, 51, 41, 90, 43, 32, 48, 34, 53, 25, 66, 39, 83, 70, 237, 81, 126, 95, 170, 35, 94, 8), etndich = c(1, 2, 1, 2, 1, 2, 1, 1, NA, 1, 1, 1, 1, 1, NA, 1, 1, 2, 1, 2, 1, 1, 1, 1, 1, 1, 1, 2, 2, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 2, 1, 1, 1, 2, 1, 1, 2, 2, 1, 1, 2, 1, 1, 2, 1, 1, 2, 2, NA, 2, 1, NA,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1, 2, 2, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, NA, 1, 1, NA, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 2, 1, 1, 2, 2), Leeftijd = c(26, 69, 67, 38, 29, 50, 29, 23, 52, 39, 50, 29, 36, 52, 43, 53, 47, 33, 52, 55, 43, 64, 35, 24, 51, 39, 50, 51, 46, 51, 30, 32, 28, 25, 52, 48, 60, 31, 61, 47, 46, 56, 38, 72, 88, 34, 56, 27, 27, 56, 52, 49, 34, 25, 22, 60, 61, 42, 45, 51, 42, 61, 69, 57, 35, 50, 42, 50, 51, 46, 28, 34, 52, 33, 30, 64, 65, 35, 31, 57, 75, 43, 46, 35, 65, 29, 29, 75, 49, 31, 57, 29, 40, 75, 30, 34, 58, 47, 37, 43, 34, 47, 46, 42, 49, 57, 46, 36, 51, 80, 45, 47, 48, 23, 51, 53, 44, 64, 44, 33, 40, 42, 29, 60, 28, 47, 47, 39, 25, 41, 39, 27, 57, 66, 42, 22, 59, 27, 43, 53, 65, 52, 41, 50, 55, 29, 55, 39, 41, 25, 74, 68, 55, 29, 77, 45, 18, 34, 49, 74, 44, 33, 48, 82, 61, 54, 46, 30, 33, 65, 51, 44, 50, 57, 27, 56, 85, 52, 31, 62, 62, 34, 48, 28, 28, 63, 30, 40, 44, 37, 73, 70, 39, 59, 56, 61, 40, 43, 33, 58, 44, 62, 26, 72, 67, 59, 48, 37, 52, 37, 57, 53, 59, 44, 71, 81, 33, 61, 50, 33, 48, 50, 63, 46, 60, 58, 40, 63, 39, 71, 38, 40, 56, 36, 52, 61, 83, 59, 43, 69, 50, 57, 38, 50, 27, 43, 46, 30, 50, 34, 68, 53, 48, 84, 41, 57, 61, 72, 27, 80, 71, 69, 61, 43, 67, 60, 58, 67, 72, 40, 79, 52, 80, 33, 25, 80, 67, 56, 66, 54, 50, 65, 39, 36, 69, 39, 34, 41, 36, 61, 33, 42, 43, 45, 48, 67, 69, 66, 37, 28, 64, 65, 68, 62, 84, 82, 59, 61, 74, 52, 41, 30, 33, 55, 55, 26, 53, 33, 64, 65, 74, 67, 70, 58, 51, 62, 67, 52, 40, 57, 57, 57, 59, 56, 61, 58, 45, 63, 61, 50, 70, 32, 50, 74, 70, 49, 42, 71, 51, 67, 46, 45, 75, 54, 75, 45, 46, 64, 60, 55, 61, 65, 68, 71, 43, 78, 53, 63, 85, 75, 66, 67, 54, 63, 68, 84, 58, 72, 70, 58, 29, 63, 83, 64, 75, 59, 76, 61, 62, 65, 61, 72, 20, 43, 67, 33, 62, 63, 51, 34, 68, 68, 60, 67, 44, 64, 69, 53, 69, 47, 41, 38, 57, 71, 70, 68, 25, 60, 71, 48, 64, 62, 72, 60, 45, 67, 59, 73, 27, 64, 66, 57, 72, 71, 77, 58, 56, 65, 74, 44, 22, 63, 42, 80, 52, 66, 60, 56, 54, 42, 68, 57, 37)), .Names = c("HbA1c", "BMI", "Comorb", "PAIDhoog", "PHQhoog", "totaalhealthcareutilization", "etndich", "Leeftijd"), row.names = c(NA, -453L), variable.labels = structure(c("HbA1c", "BMI level", "", "", "", "", "", ""), .Names = c("HbA1c", "BMI", "Comorb", "PAIDhoog", "PHQhoog", "totaalhealthcareutilization", "etndich", "Leeftijd")), codepage = 65001L, class = "data.frame")
执行GLM时,R输出如下:
fit <- glm(formula = totaalhealthcareutilization ~ PAIDhoog + PHQhoog +
Comorb + Leeftijd + etndich, family = Gamma(link = log),
data = df)
summary(fit)
#
#Call:
#glm(formula = totaalhealthcareutilization ~ PAIDhoog + PHQhoog +
# Comorb + Leeftijd + etndich, family = Gamma(link = log),
# data = df)
#
#Deviance Residuals:
# Min 1Q Median 3Q Max
#-2.1297 -0.7231 -0.3018 0.2075 3.1365
#
#Coefficients:
# Estimate Std. Error t value Pr(>|t|)
#(Intercept) 3.638751 0.267741 13.591 < 2e-16 ***
#PAIDhoog0 -0.201881 0.131777 -1.532 0.1264
#PHQhoog0 -0.126989 0.157416 -0.807 0.4203
#Comorbgeen -0.638842 0.144459 -4.422 1.28e-05 ***
#Comorb1 -0.348187 0.158484 -2.197 0.0286 *
#Leeftijd 0.007311 0.003534 2.069 0.0392 *
#etndich1 -0.151836 0.118872 -1.277 0.2023
#---
#Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
#
#(Dispersion parameter for Gamma family taken to be 0.9432289)
#
# Null deviance: 286.49 on 381 degrees of freedom
#Residual deviance: 243.01 on 375 degrees of freedom
# (71 observations deleted due to missingness)
#AIC: 3156
#
#Number of Fisher Scoring iterations: 6
和SPSS输出:
Parameter Estimates
Parameter B Std. Error 95% Wald Confidence Interval Hypothesis Test
Lower Upper Wald Chi-Square df Sig.
(Intercept) 3,639 ,2177 3,212 4,065 279,350 1 ,000
[PAIDhoog=0] -,202 ,1056 -,409 ,005 3,657 1 ,056
[PAIDhoog=1] 0a . . . . . .
[PHQhoog=0] -,127 ,1260 -,374 ,120 1,015 1 ,314
[PHQhoog=1] 0a . . . . . .
[Comorb=1] -,639 ,1148 -,864 -,414 30,940 1 ,000
[Comorb=2] -,348 ,1250 -,593 -,103 7,758 1 ,005
[Comorb=3] 0a . . . . . .
[etndich=1,00] -,152 ,0936 -,335 ,032 2,633 1 ,105
[etndich=2,00] 0a . . . . . .
Leeftijd ,007 ,0028 ,002 ,013 6,599 1 ,010
(Scale) ,581b ,0387 ,510 ,662
Dependent Variable: totaalhealthcareutilization
Model: (Intercept), PAIDhoog, PHQhoog, Comorb, etndich, Leeftijd
a Set to zero because this parameter is redundant.
b Maximum likelihood estimate.
如果我将SPSS中的“比例参数方法”更改为“皮尔逊卡方”,则将再现精确的R结果。但是,我想对R中的SPSS结果做完全相同的事情。是否可以在R中更改比例参数方法?
如果需要更多信息,请告诉我。