我有一个数据,其结果是机器在 2 天内在一个区域内观察到的物种的比例。由于结果是一个比例,不包括 0 或 1,我使用 beta 回归来拟合模型。温度用作自变量。这是一些玩具 R 代码:
set.seed(1234)
library(betareg)
d <- data.frame(
DAY = c(1,1,1,1,2,2,2,2),
Proportion = c(.4,.1,.25, .25, .5,.3,.1,.1),
MACHINE = c("A","B","C","D","H","G","K","L"),
TEMPERATURE = c(rnorm(8)*100)
)
b <- betareg(Proportion ~ TEMPERATURE,
data= d, link = "logit", link.phi = NULL, type = "ML")
summary(b)
## Call:
## betareg(formula = Proportion ~ TEMPERATURE, data = d, link = "logit", link.phi = NULL, type = "ML")
##
## Standardized weighted residuals 2:
## Min 1Q Median 3Q Max
## -1.2803 -1.2012 0.3034 0.6819 1.6494
##
## Coefficients (mean model with logit link):
## Estimate Std. Error z value Pr(>|z|)
## (Intercept) -1.0881982 0.2620518 -4.153 3.29e-05 ***
## TEMPERATURE 0.0003469 0.0023677 0.147 0.884
##
## Phi coefficients (precision model with identity link):
## Estimate Std. Error z value Pr(>|z|)
## (phi) 9.305 4.505 2.066 0.0389 *
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
上面你可以看到TEMPERATURE
系数是 0.0003469。求幂,exp(.0003469) = 1.000347
更新合并回复和评论:
您可以在这里看到如何将温度从 -10 增加到 10 增加 1 个单位来增加比例
nd <- data.frame(TEMPERATURE = seq(-10, 10, by = 1))
nd$Proportion <- predict(b, newdata = nd)
nd$proportion_ratio <- nd$Proportion/(1 - nd$Proportion)
plot(Proportion ~ TEMPERATURE, data = nd, type = "b")
解释是: 1 个单位的变化TEMPERATURE
导致 1.000347 ≈0.04% 的相对变化Proportion
:
关键词有相对变化,所以当你比较时exp(coef(b))[2]
,nd$proportion_ratio[2] / nd$proportion_ratio[1]
你会发现它们是相同的
## ratio of proportion
nd$proportion_ratio[2] / nd$proportion_ratio[1]
exp(coef(b))[2]
nd$proportion_ratio[-1] / nd$proportion_ratio[-20]