I'm trying to run a power analysis based on pilot study. I'm using a glmer mixed effects model with a binomial logit link. The model's equation is:
success ~ group + (1|user_id)
I have about 2000 observations per each group (variable number of observations per user). I'd like to estimate the required sample size per group required to have 80% Power to detect an effect size of 0.1. I'd like to extend the power analysis to atleast 20000 observations per group to see how n observations impacts power.
model = glmer("success ~ group + (1|user_id)", df, family = binomial(link='logit'))
set_fixef = function(o, s, v){
fixef(o)[s] <- v
return(o)
}
power_model = set_fixef(model, 'groupexperiment', 0.1)
power1 = powerCurve(extend(power_model, along = "user_id", n = 20), test=fixed("groupexperiment", "z"), along = "user_id")
This code isn't really doing much for me, I'm having trouble figuring out how to really estimate Power for this type of model.
The idea is that I'm mimicking a two proportion Z test, but with a mixed effects model to account for multiple observations per user