0
votes

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.

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).

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

"Error in sfun(object, nsim = 1, ftd = rep_len(musim, n * nsim), wts = weights): cannot simulate from non-integer prior.weights"

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)))

Error in sfun(object, nsim = 1, ftd = rep_len(musim, n * nsim), wts = weights): cannot simulate from non-integer prior.weights

1

1 Answers

0
votes

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)

Here is the link to the function: std_beta