我正在估计多级逻辑回归,以预测在给定试验中出错的可能性。该模型具有参与者,场景和演员的随机效应,以及基于两个变量及其相互作用的固定效应。结果如下:
a1 <- glmer(errorDummy ~ race*object + #fixed effects
(1|participant) + (1|scenario) + (1|actor), #random effects
data = df,
control = glmerControl(optimizer="bobyqa"),
family = binomial(link = "logit")) #binomial
print(summary(a1), correlation = F) #decision to shoot
Generalized linear mixed model fit by maximum likelihood (Laplace Approximation) ['glmerMod']
Family: binomial ( logit )
Formula: errorDummy ~ race * object + (1 | participant) + (1 | scenario) + (1 | actor)
Data: df
Control: glmerControl(optimizer = "bobyqa")
AIC BIC logLik deviance df.resid
6704.4 6759.2 -3345.2 6690.4 18397
Scaled residuals:
Min 1Q Median 3Q Max
-2.557 -0.230 -0.108 -0.045 40.303
Random effects:
Groups Name Variance Std.Dev.
participant (Intercept) 0.6115 0.7820
actor (Intercept) 0.8919 0.9444
scenario (Intercept) 1.3102 1.1446
Number of obs: 18404, groups: participant, 630; actor, 20; scenario, 8
Fixed effects:
Estimate Std. Error z value Pr(>|z|)
(Intercept) -4.1705 0.4666 -8.938 <2e-16 ***
raceblack 0.1942 0.4410 0.440 0.66
objectgun -2.9482 0.1059 -27.846 <2e-16 ***
raceblack:objectgun -0.3143 0.2074 -1.516 0.13
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
该模型显示此任务中不常见错误。但是,它们在不同情况下确实有所不同:
coef(a1)$scenario
(Intercept) raceblack objectgun raceblack:objectgun
alley -2.331117 0.1942088 -2.948222 -0.3142849
domesticphone -3.539802 0.1942088 -2.948222 -0.3142849
grocery -5.314944 0.1942088 -2.948222 -0.3142849
parkinglot -4.098250 0.1942088 -2.948222 -0.3142849
pulloverday -3.084138 0.1942088 -2.948222 -0.3142849
pullovernight -3.971451 0.1942088 -2.948222 -0.3142849
sidewalk -5.619601 0.1942088 -2.948222 -0.3142849
warehouse -4.539444 0.1942088 -2.948222 -0.3142849
我想要的是在比例尺上对八个场景的每一个的条件模式的估计(最佳线性无偏预测?)。就是说,我想估计在给定情况下试验出错的可能性。
我知道在非多层逻辑回归中用于截距的公式为p = exp(logit)/(1 + exp(logit)。这将转化为p = exp( -4.1705)/(1 + exp(-4.1705))。但是,我确信这在具有随机因素的多级上下文中是有问题的。
在给定情况下,估计在试验中出错的可能性的适当方法是什么? R中是否有可能内置了此功能的软件包?