I'm using R's lme4. Suppose I have a mixed-effects logistic-regression model where I want some random slopes shared by every observation. They're supposed to be random in the sense that these random slopes should all come from a single normal distribution. This is essentially the same thing as ri...
@Kodiologist I don't really understand what you are trying to do - I have the same problem as the first commenter there, and your reply does not make it clearer. Can you describe here what you want to do with more details?
You have 5 predictors and want to estimate five betas but such that they come from a common gaussian distribution? I.e. you want to estimate the mean and the variance of this distribution over five betas?
Yes. In any case, this is definitely not a programming, but a statistics Q, so you should rather post it here - and I would frame it a bit differently as well (not "where is the mistake in my code", but rather "is it a mixed model at all and if yes how can I approach it with lme4")
Now thinking about it, when we have usual random slopes term (b|subject) in a lmer model, it technically refers to several binary dummy predictors ("subject") and their betas ("b"), and your situation is identical with the only difference that instead of dummy predictors you have five real predictors.
@amoeba I know; I'm just working through the implications of your earlier point that suggested similarity between (value | x) with value numeric and x categorical indexing the covariate. That isn't what is wanted but it is the only thing lme4 can do.
I'll caveat that by adding "without getting deep under the hood of lme4". The underlying machinery is quite flexible I am told if you understand what Doug Bates was doing with the code. A colleague has used the underlying machinery to fit a wider range of models than the lme4 interface allows via lmer(). But doing that requires almost intimate knowledge of the lme4 internals.
If the b's are supposed to be equal, all you need to do @Kodiologist is to put the sum of the independent variables on the right hand side. This constrains the slopes (and the variance for mixed effects) to all be drawn from the same distribution.