I'm little bit struggle this 4 past days about a specification of a likelihood in the context of correlation between a random intercept and covariables in generalized mixed models. A known approach is to suppress the random intercept by conditioning on it.
My work is based on the article Separating between- and within-Cluster Covariate Effects by Using Conditional and Partitioning Methods of John M.Neuhaus and Charles E.McCulloch

For my context: $$ f(y_i \mid x_i, b_i) \sim B(\pi(x_i)) \\ b_i \sim N(0, \sigma_b^2) \\ x_i \mid b_i \sim N(0, \sigma_x^2) $$ with $$ \pi(x_i) = \frac{1}{1+\exp(-(X\beta + Zb))} $$

And I have to implement this to estimate the fixed effects: $$ f(y_i, x_i) = \int_b f(y_i, x_i \mid b) dG(b)\\ = \int_b f_y(y_i \mid x_i, b)f_{x|b}(x_i \mid b) dG(b) $$ Conceptually, I have no problem to derive this results of Bayes Theorem and marginal distribution. But I'm really struggle to implement the last equality in R.

So, I re-write my equality with my respected distributions as followed:
$$\int_b \pi(x_i)^{y_i}(1-\pi(x_i))^{1-y_i}\frac{1}{\sigma_x\sqrt(2\pi)}\exp(-\frac{1}{2\sigma_x^2}x^2)\frac{1}{\sigma_b\sqrt(2\pi)}\exp(-\frac{1}{2\sigma_b^2}b^2)db \\ $$

Here I have a problem to evaluate my fixed effects. Did I specify my integrand fine ? Because I didn't, my likelihood will be incorrect. I can't estimate my coefficient fine.

Thanks for your help.



1 Answer 1


It is not clear where exacly $x_i$ enters into the equation of $\pi(x_i)$, but, in general, integrals of the form you have written in the specification of the marginal distribution need to be numerically approximated. Popular ways to do this are the adaptive Gaussian quadrature rule and the Laplace approximation.

  • $\begingroup$ My question is definitly here, suppose my integral is well specified, how I can approximated it by Gaussian Quadrature or numerical algorithms ? if you have just one R code example, I'll be grateful. $\endgroup$ Apr 3, 2019 at 15:10

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.