如何解决从逻辑回归模型 (R::lme4) 中提取具有 95% CI 的预测器效果
我有一个逻辑回归模型,使用 logit 链接。如何在“y”的概率范围内提取预测变量的“x”效应,包括 95% CI?预测变量“x”是一个连续变量。
数据
library(tidyverse)
n = 100
a = tibble(y = rep(c("pos","neg","neg"),length.out = n),x = rep(3,group = rep(letters[1:7],length.out = n))
b = tibble(y = rep(c("pos","pos",x = rep(2,length.out = n))
c = tibble(y = rep(c("pos",x = rep(1,length.out = n))
d = rbind(a,b)
df = rbind(d,c)
df = df %>% mutate(y = as.factor(y))
df
[![在此处输入图片描述][1]][1]
模型
library("lme4")
m = glmer(
y ~ x + (x | group),data = df,family = binomial(link = "logit"))
m
总结
Generalized linear mixed model fit by maximum likelihood (Laplace Approximation) [glmerMod]
Family: binomial ( logit )
Formula: y ~ x + (x | group)
Data: df
AIC BIC logLik deviance df.resid
373.5635 392.0824 -181.7817 363.5635 295
Random effects:
Groups Name Std.Dev. Corr
group (Intercept) 0.000e+00
x 3.961e-09 NaN
Number of obs: 300,groups: group,7
Fixed Effects:
(Intercept) x
2.197 -1.099
optimizer (Nelder_Mead) convergence code: 0 (OK) ; 0 optimizer warnings; 1 lme4 warnings
解决方法
您可以使用 public abstract class Subscriber<TExchange> : ISubscriber<TQueue,TMessage>
where TExchange : IEventBusExchange<TQueue,TMessage>
{
...
}
,请参阅 the help page 了解更多详细信息,在您的示例中,您没有模拟组的随机效应,因此 confint()
可能无法估计。>
以下是示例数据集的示例,我将因变量 (x|groups)
离散化以用于二项式:
Reaction
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。