R中的二项式GLM:系数谈论什么?

发布于 2025-01-30 22:20:50 字数 1382 浏览 2 评论 0原文

我想知道二项式GLM模型的系数是什么。在我的假设数据中:

# Create the dataset
set.seed(1)
n <- 50
cov <- 10
x <- c(rep(0,n/2), rep(1, n/2))
p <- 0.4 + 0.2*x
y <- rbinom(n, cov, p)

现在,我们使用logit链接:

model0 <- glm(cbind(y, cov-y) ~ x, family="binomial")
summary(model0)
# Call:
# glm(formula = cbind(y, cov - y) ~ x, family = "binomial")

# Deviance Residuals: 
#      Min        1Q    Median        3Q       Max  
# -1.50013  -0.58688  -0.05123   0.48348   2.43452  

# Coefficients:
#             Estimate Std. Error z value Pr(>|z|)    
# (Intercept)  -0.3064     0.1280  -2.394 0.016668 *  
# x             0.6786     0.1815   3.739 0.000185 ***
# ---
# Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

# (Dispersion parameter for binomial family taken to be 1)

#     Null deviance: 53.720  on 49  degrees of freedom
# Residual deviance: 39.537  on 48  degrees of freedom
# AIC: 177.99

# Number of Fisher Scoring iterations: 4

返回原始数据量表

model_intercept <- 1/(1+(1/(exp(model0[[1]][1]))))
model_intercept
# (Intercept) 
#       0.424
model_x <- 1/(1+(1/(exp(model0[[1]][2]))))
model_x
#         x 
# 0.6634292 

,然后从这里开始,从我开始出现大混乱。 0.6634292值意味着y的增加速率为x的0.6634292。或0.6634292表示使用X间隔使用X间隔为66,34292%的平均增加率。和 关于拦截?尽管X含量为0.4单位,但尽管二项式模型为负值,但Y的含量为0.4单位。

预先感谢您的时间和帮助。

I'd like to uderstand what the coefficents of the binomial GLM models are. In my hypothetical data:

# Create the dataset
set.seed(1)
n <- 50
cov <- 10
x <- c(rep(0,n/2), rep(1, n/2))
p <- 0.4 + 0.2*x
y <- rbinom(n, cov, p)

Now we fit a logistic regression model with x as a covariate, using the logit link:

model0 <- glm(cbind(y, cov-y) ~ x, family="binomial")
summary(model0)
# Call:
# glm(formula = cbind(y, cov - y) ~ x, family = "binomial")

# Deviance Residuals: 
#      Min        1Q    Median        3Q       Max  
# -1.50013  -0.58688  -0.05123   0.48348   2.43452  

# Coefficients:
#             Estimate Std. Error z value Pr(>|z|)    
# (Intercept)  -0.3064     0.1280  -2.394 0.016668 *  
# x             0.6786     0.1815   3.739 0.000185 ***
# ---
# Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

# (Dispersion parameter for binomial family taken to be 1)

#     Null deviance: 53.720  on 49  degrees of freedom
# Residual deviance: 39.537  on 48  degrees of freedom
# AIC: 177.99

# Number of Fisher Scoring iterations: 4

Returning to the original data scale

model_intercept <- 1/(1+(1/(exp(model0[[1]][1]))))
model_intercept
# (Intercept) 
#       0.424
model_x <- 1/(1+(1/(exp(model0[[1]][2]))))
model_x
#         x 
# 0.6634292 

And here from me starting a big confusion. The 0.6634292 values mean that the y increases at a rate of 0.6634292 per unit of x. Or 0.6634292 means 66,34292% mean increase rate of y with x interval used. And
about the intercept? Something like despite x the y starts at 0.4 units, despite the negative value in the binomial model.

Thanks in advance for your time and help.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文