如何使用r中的GLM获得相互作用的p值和CI的效果
在多变量GLM模型中,我需要计算以下交互项目的简单效果: 性别(女性与男性)*不愉快(是与否)
该模型具有as.factor变量,我的参考变量为男性= 1,不及时容纳(no)= 0。 在我的模型中,女性= 2并且不稳定地容纳(是)= 1
我编写了以下代码,但不确定如何计算上述每个类别的OR,CI和不同的p值。
model <- glm(depression ~ as.factor(unstablyhoused) + as.factor(SEXBRTH) + as.factor(unstablyhoused)*as.factor(SEXBRTH),
data=mergedata, family = binomial(link='logit'), na.action = na.omit)
summary(model)
confint(model)
exp(coef(model))
exp(cbind(OR = coef(model), confint(model)))
我的问题是如何计算OR,置信区间(95%CI),以及相互作用的效果的P值:
- 在那些不及时的性爱的人中(女性与男性)(女性与男性)
- (女性)(女性与男性)在那些不舒服地安置的人中
- (是的,是与否)中的女性
- (是的)(是的
)计算1-4个项目,将不胜感激。 的OR,置信区间和p值
我需要知道简单主要效果模型图
In a multivariable GLM model, I need to calculate the simple effects of the following interaction item:
sex (female vs. male)*unstablyhoused (yes vs. no)
The model has as.factor variables, with my reference variables being Male = 1, unstably housed (no) = 0.
In my model, female = 2 and unstably housed (yes) = 1
I have written the following code but not sure how can I calculate the OR's, CI, and different p-values for each of the categories stated above.
model <- glm(depression ~ as.factor(unstablyhoused) + as.factor(SEXBRTH) + as.factor(unstablyhoused)*as.factor(SEXBRTH),
data=mergedata, family = binomial(link='logit'), na.action = na.omit)
summary(model)
confint(model)
exp(coef(model))
exp(cbind(OR = coef(model), confint(model)))
My question is how do I calculate the OR, confidence interval (95% CI), and p-values for the effect of the interaction when:
- sex(female vs. male) among those who are unstably housed
- sex (female vs. male) among those who do NOT unstably housed
- unstablyhoused (yes vs. no) among those that are female
- unstablyhoused (yes vs. no) among those that are NOT female
Any help and direction in what code to use to be able to calculate 1-4 items, would be greatly appreciated. I need to know the OR, confidence intervals, and p-value of the simple main effects
ModelOutput
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论