I usually work in SAS or R, so when I code a GLM with a random intercept, it's usually pretty easy. However, I've been running into a few problems (too complicated to get into here) where it might be useful to code my own random intercept in python.

However, I'm not sure how to code a random intercept, or even how it differs from a dummy variable. Does it? I've always been told that fixed and random effects need to be treated separately and there are lots of theoretical reasons why that's true. I understand the theoretical reasons.

So what's the difference on the back end? Would my GLM be that different if I replaced a random intercept with a dummy variable?

If they are substantially different, how can I approximate a random intercept without a pre-defined random-intercept function?



Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.