R, Julia and Python implementation of the fully endogenized finite mixture model used in forthcoming articles by Fuad and Farmer (202-) and Fuad, Farmer, and Abidemi (202-). Codes presented are for two submarkets that can be modified for more than two submarkets.
This model employs a finite mixture model to sort households into endogenously determined latent submarkets. The finite mixture model to predict home prices is:
The mixing model
We also define
Since the submarket identification (
The Expectation step – the E step – involves imputation of the expected value of
-
Generate starting values for
$\gamma, \beta, \pi$ -
Initiate iteration counter for the E-step,
$t$ (initial$t$ at 0) -
Use
$\beta^t$ and$\pi^t$ from Step 2 to calculate provisional$d^t$ from$d_{ij}=\frac{e^{\gamma_j z_i}}{1+\sum_{C=1}e^{\gamma_j z_i}}$ -
Initiate second iteration counter,
$v$ , for the M-step -
Interim estimators of
$d^{t+1}$ are then used to impute new estimates of$\beta^{v+1}$ and$\pi^{v+1}$ with$d_{ij}=\frac{\pi_j f_j (P_i | x_i, \beta_j)}{\sum_{j=1} \pi_j f_j (P_i | x_i, \beta_j)}$ -
For each prescribed latent class, estimators of
$\beta^{v+1}$ are imputed, via M-step, as well as$\pi^{v+1}$ -
Increase
$v$ counter by 1, and repeat M-step until:$f(\beta^{v+1}y, x, \pi, d) - f(\beta^vy, x, \pi, d) < \alpha$ prescribed constant; if yes, then$\beta^{t+1}=\beta^{v+1}$ -
Increase
$t$ counter and continue from Step 3 until:$f(\beta^{t+1}, \pi^{t+1}, d | y) - f(\beta^t, \pi^t, d | y) < \alpha$ prescribed constant
This process is repeated until there is no change in the likelihood function:
The steps above, particularly from Step 3-8 do not necessarily occur sequentially as outlined above but occur simultaneously as the continual updating of estimators. Each
The modified hedonic regression is: