Skip to content
/ fmm Public

R, Julia and Python implementation of the two submarket fully endogenized finite mixture model used in forthcoming articles by Fuad and Farmer (202-) and Fuad, Farmer, and Abidemi (202-).

Notifications You must be signed in to change notification settings

syedmfuad/fmm

Repository files navigation

fully endogenized finite mixture model

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:

h ( P i | x i , β j , p j ) = j = 1 π ( z i ) f ( P i | x i , β j )

The mixing model π ( z i ) , is used to assign each observation a percentage chance of belonging to each latent submarket and f ( . ) is a submarket specific conditional hedonic regression. The home price is therefore a weighted average of predicted values across submarkets weighted by the probability of being located in the submarket.

We also define d i = ( d i 1 , d i 2 , . . . , d i m ) to be binary variables that indicate the inclusion of household i into each latent group. These are incorporated into the likelihood function based on a logistic function which are conditional on factors that do not directly influence the price of the house.

Since the submarket identification ( d ) is not directly observable, an expectation maximization (EM) algorithm is used to estimate the likelihood of class identification: d i j = π j f j ( P i | x i , β j ) j = 1 π j f j ( P i | x i , β j )

The Expectation step – the E step – involves imputation of the expected value of d i given the mixing covariates, interim estimates of γ , β , π . The Maximization step – the M step – involves using estimates of d i from the E step to update the component fractions of π j and β . The EM algorithm can be summarized as:

  1. Generate starting values for γ , β , π

  2. Initiate iteration counter for the E-step, t (initial t at 0)

  3. Use β t and π t from Step 2 to calculate provisional d t from d i j = e γ j z i 1 + C = 1 e γ j z i

  4. Initiate second iteration counter, v , for the M-step

  5. Interim estimators of d t + 1 are then used to impute new estimates of β v + 1 and π v + 1 with d i j = π j f j ( P i | x i , β j ) j = 1 π j f j ( P i | x i , β j )

  6. For each prescribed latent class, estimators of β v + 1 are imputed, via M-step, as well as π v + 1

  7. Increase v counter by 1, and repeat M-step until: f ( β v + 1 y , x , π , d ) f ( β v y , x , π , d ) < α prescribed constant; if yes, then β t + 1 = β v + 1

  8. Increase t counter and continue from Step 3 until: f ( β t + 1 , π t + 1 , d | y ) f ( β t , π t , d | y ) < α prescribed constant

d i j is estimated simultaneously with the estimation of the hedonic regression parameters, which are conditional on class identification:

This process is repeated until there is no change in the likelihood function: L o g L = i = 1 j = 1 d i j l o g [ f j ( P i | x i , β j ) ] + d i j l o g [ π j ]

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 v iteration conditionally maximizes the likelihood function using interim estimates of observation latent class membership probabilities in one of the latent classes; while each t iteration updates latent class memberships.

The modified hedonic regression is: y i j = d i j ( β j X i ) + ϵ i j

About

R, Julia and Python implementation of the two submarket fully endogenized finite mixture model used in forthcoming articles by Fuad and Farmer (202-) and Fuad, Farmer, and Abidemi (202-).

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published