# Panel Data, Numerical Integration and Latent Class

18 views

### Felipe Gonzalez Espejo

Aug 3, 2021, 10:01:54 AMAug 3
to Biogeme
Hi,

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,

Thanks!!

### Bierlaire Michel

Aug 3, 2021, 10:20:02 AMAug 3
to fjgon...@uc.cl, Bierlaire Michel, Biogeme
It is more complicated. With panel data, you need to integrate the trajectory. I would recommend to use Monte-Carlo for this.

You need first to write the choice model condition on alpha (the random parameter, the agent effect) for each time interval and each class: P(i_t | alpha, class 1) P(class 1 | alpha) + P(i_t | alpha, class 2) P(class 2 | alpha)
Then you calculate the product of these quantities across time (this is the trajectory).
Then you integrate.

--
You received this message because you are subscribed to the Google Groups "Biogeme" group.
To unsubscribe from this group and stop receiving emails from it, send an email to biogeme+u...@googlegroups.com.