本文介绍了glmer对象的预测概率的置信区间,bootMer错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要从逻辑混合效应模型计算95%的置信区间或预测概率,该模型是使用lme4 R软件包的glmer函数创建的.该模型包括稳定的概率加权,以校正分析数据上的选择偏差.

I need to calculate 95% confidence intervals or predicted probabilities from a logistic mixed effects model, created using the glmer function from lme4 R package. The model includes a stabilized probability weighting to correct for the selecttion bias on the analized data.

我已经阅读了bootMer函数(lme4程序包)执行基于模型的半参数引导,该过程使获得CI作为分布的分位数(分位数方法)变得很容易.

I've read that bootMer function (lme4 package) perform a Model-based semi-parametric bootstraping that makes staighforward to get the CI's as the quantiles of the distribution (quantile approach).

但是,当我应用功能bootMer时,会产生以下错误:

Nevertheless, when I apply the function bootMer, the following error is generated:

我必须使用非整数权重,所以我的问题是如何使用bootMer函数解决此问题?或者,如果不可能的话,还有其他选择吗?

I must use a non-integer weights, so my question is ¿How can I solve this problem using bootMer function? Or if it's impossible, ¿Are anny alternatives?

#The model
M1s = glmer(plab ~ 1 + edad2_c + I(edad2_c^2) + periodo_c + cohorte + nocu_c + tipoocu2 + sector + educ + benef + genero + ecivil + area + generojh + edadjh2_c + nhogar_c + nhogar05_c + nhogar0614_c + nhogar66_c + (1 | periodo_c), weights = ipw,
 data = seriecasen,family = binomial(link=logit),nAGQ = 10,glmerControl(optimizer = "bobyqa", optCtrl = list(maxfun = 2e5)))

#Model-based semi-parametric bootstrap for mixed models - CI's predicted probabilites
merBoot <- bootMer(M1s, predict, nsim = 1000, use.u = TRUE, type = c("parametric"), seed = 1959)
CI.lower = apply(merBoot$t, 2, function(x) as.numeric(quantile(x, probs=.025, na.rm=TRUE)))
CI.upper = apply(merBoot$t, 2, function(x) as.numeric(quantile(x, probs=.975, na.rm=TRUE)))

推荐答案

替代方法是 sjstats 包中的 std_beta()函数.没有数据就很难在模型上进行测试,但是我已经在我自己的逻辑回归中执行了此功能,它似乎提供了标准化的beta以及置信区间.以下代码可能应该可以工作:

An alternative is the std_beta() function from the sjstats package. It's difficult to test on your model without your data, but I've performed this function on my own logistic regression and it seems to provide your standardized beta, along with the confidence interval(s). The following code should likely work:

sjstats :: std_beta(M1s)

以下是该函数的链接: std_beta

Here is the link to the function: std_beta

这篇关于glmer对象的预测概率的置信区间,bootMer错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-20 10:30