I´m trying to use numerical integration for a mixed logit model with panel data and two latent classes. I have a few questions regarding this issue. I understand that for one random term, the numerical integration function is written as follows:
logprob = log(Integrate(condprob * density, 'omega'))
1. For a two latent class model, and panel data, how can you write this? The code I believe could be appropriate is the following. Is it correct?
prob = PanelLikelihoodTrajectory(LatProb * Integrate(condprob1 * density, 'omega') + (1- LatProb) * Integrate (Latcondprob * Latdensity, 'Lat_omega'))
logprob = log(prob)
2. I understand that for two random parameters, it is feasible to apply numerical integration in a precise and relatively fast way. Can I do this when estimating latent classes as well? I would then have 4 random parameters, but the 2 integrals to estimate would be independent from one another. How could i write these integrals? My approach would be the following, for each integration. Would it be appropiate? If not, how can I do it?
Integrate(Integrate(condprob * density1, 'omega1')) * density2, 'omega2')
Any help could be useful,