# NM-method

The NM-method or Naszodi–Mendonca method is the operation that can be applied in statistics, econometrics, economics, sociology, and demography to construct counterfactual contingency tables. The method finds the matrix $X$ ($X\in \mathbb {R} ^{n\times m}$) which is "closest" to matrix $Z$ ($Z\in \mathbb {N} ^{n\times m}$ called the seed table) in the sense of being ranked the same but with the row and column totals of a target matrix $Y$ $(Y\in \mathbb {N} ^{n\times m})$. While the row totals and column totals of $Y$ are known, matrix $Y$ itself may not be known.
Since the solution for matrix $X$ is unique, the NM-method is a function: $X={\text{NM}}(Z,Ye_{m}^{T},e_{n}Y):\mathbb {N} ^{n\times m}\times \mathbb {N} ^{n}\times \mathbb {N} ^{m}\mapsto \mathbb {R} ^{n\times m}$, where $e_{n}$ is a row vector of ones of size $1\times n$, while $e_{m}^{T}$ is a column vector of ones of size $m\times 1$.
The NM-method was developed by Naszodi and Mendonca (2021) (and first applied by Naszodi and Mendonca (2019) to solve for matrix $X$ in problems, where matrix ${\boldsymbol {Z}}$ is not a sample from the population characterized by the row totals and column totals of matrix $Y$, but represents another population.
Their application aimed at quantifying intergenerational changes in the strength of educational homophily and thus measuring the historical change in social inequality between different educational groups in the US between 1980 and 2010. The trend in inequality was found to be U-shaped, supporting the view that with appropriate social and economic policies inequality can be reduced.

## Definition of matrix ranking

The closeness between two matrices of the same size can be defined in several ways. The Euclidean distance, and the Kullback-Leibler divergence are two well-known examples.
The NM-method is consistent with a definition relying on the ordinal Liu-Lu index which is the slightly modified version of the Coleman-index defined by Eq. (15) in Coleman (1958). According to this definition, matrix $X$ is "closest" to matrix $Z$, if their Liu-Lu values are the same. In other words, if they are ranked the same by the ordinal Liu-Lu index.
If $Z$ is a 2×2 matrix, its scalar-valued Liu-Lu index is defined as
${\text{LL}}(Z)={\frac {Z_{1,1}-Q^{-}(Z_{1,1})}{{\text{min}}(Z_{1,.},Z_{.,1})-Q^{-}(Z_{1,1})}}$ , where $Z_{1,.}=Z_{1,1}+Z_{1,2}$; $Z_{.,1}=Z_{1,1}+Z_{2,1}$; $Z_{.,.}=Z_{.,1}+Z_{1,.}$; $Q(Z_{1,1})={Z_{1,.}Z_{.,1}}/{Z_{.,.}}$; $Q^{-}(Z_{1,1})=int[Q(Z_{1,1})]$.
Following Coleman (1958), this index is interpreted as the “actual minus expected over maximum minus minimum”, where $Z_{1,1}$ is the actual value of the $1,1$ entry of the seed matrix $Z$; $Q^{-}$ is its expected (integer) value under the counterfactual assumptions that the corresponding row total and column total of $Z$ are predetermined, while its interior is random. Also, $Q^{-}$ is its minimum value if the association between the row variable and the column variable of $Z$ is non-negative. Finally, ${\text{min}}(Z_{1,.},Z_{.,1})$ is the maximum value of $Z_{1,1}$ ($Z\in \mathbb {N} ^{n\times m}$) for given row total $Z_{1,.}$ and column total $Z_{.,1}$.
For matrix $Z$ of size n×m ($n\geq 2$, $m\geq 2$), the Liu-Lu index was generalized by Naszodi and Mendonca (2021) to a matrix-valued index. One of the preconditions for the generalization is that the row variable and the column variable of matrix $Z$ have to be ordered. Equating the generalized, matrix-valued Liu-Lu index of $Z$ with that of matrix $X$ is equivalent to dichotomizing their ordered row variable and ordered column variable in $(n-1)\times (m-1)$ ways by explointing the ordered nature of the row and column variables. Than, equating the original, scalar-valued Liu-Lu indices of the 2×2 matrices obtained with the dichotomizations. I.e., for any pair of $i,j$ ($i\in \{1,\ldots ,n-1\}$, and $j\in \{1,\ldots ,m-1\}$) the restriction ${\text{LL}}(V_{i}XW_{j}^{T})={\text{LL}}(V_{i}ZW_{j}^{T})$ is imposed, where $V_{i}$ is the $2\times n$ matrix $V_{i}={\begin{bmatrix}\color {red}1&\color {red}\cdots &\color {red}1&\color {blue}0&\color {blue}\cdots &\color {blue}0\\\color {red}0&\color {red}\cdots &\color {red}0&\color {blue}1&\color {blue}\cdots &\color {blue}1\end{bmatrix}}$ with its first block being of size $2\times i$, and its second block being of size $2\times (n-i)$. Similarly, $W_{j}^{T}$ is the $m\times 2$ matrix given by the transpose of $W_{j}={\begin{bmatrix}\color {red}1&\color {red}\cdots &\color {red}1&\color {blue}0&\color {blue}\cdots &\color {blue}0\\\color {red}0&\color {red}\cdots &\color {red}0&\color {blue}1&\color {blue}\cdots &\color {blue}1\end{bmatrix}}$ with its first block being of size $2\times j$, and its second block being of size $2\times (m-j)$.

## Constraints on the row totals and column totals

Matrix $X$ should satisfy not only ${\text{LL}}(V_{i}XW_{j}^{T})={\text{LL}}(V_{i}ZW_{j}^{T})$ but also the pair of constraints on its row totals and column totals: $Xe_{m}^{T}=Ye_{m}^{T}$ and $e_{n}X=e_{n}Y$.

## Solution

Assuming that ${\text{LL}}(V_{i}ZW_{j}^{T})\geq 0$ for all pairs of $i,j$ (where $i\in \{1,\ldots ,n-1\}$, and $j\in \{1,\ldots ,m-1\}$), the solution for $X$ is unique, deterministic, and given by a closed-form formula.
For matrices $Y$ and $Z$ of size ${\boldsymbol {2\times 2}}$, the solution is
$X_{1,1}={\frac {\left[Z_{1,1}-{\text{int}}\left({Z_{1,\cdot }Z_{\cdot ,1}}/{Z_{\cdot ,\cdot }}\right)\right]\left[{{\text{min}}\left(Y_{1,\cdot },Y_{\cdot ,1}\right)-{\text{int}}\left({Y_{1,\cdot }Y_{\cdot ,1}}/{Y_{\cdot ,\cdot }}\right)}\right]}{{\text{min}}\left(Z_{1,\cdot },Z_{\cdot ,1}\right)-{\text{int}}\left({Z_{1,\cdot }Z_{\cdot ,1}}/{Z_{\cdot ,\cdot }}\right)}}+{\text{int}}\left({Y_{1,\cdot }Y_{\cdot ,1}}/{Y_{\cdot ,\cdot }}\right)$.
The other 3 cells of $X$ are uniquely determined by the row totals and column totals. So, this is how the NM-method works for 2×2 seed tables.
For $Y$, and $Z$ matrices of size ${\boldsymbol {n\times m}}$ ($n\geq 2$, $m\geq 2$), the solution is obtained by dichotomizing their ordered row variable and ordered column variable in all possible meaningful ways before solving $(n-1)(m-1)$ number of problems of 2×2 form. Each problem is defined for an $i,j$ pair ($i\in \{1,...,n-1\}$ and $j\in \{1,...,m-1\}$) with ${\text{LL}}(V_{i}XW_{j}^{T})={\text{LL}}(V_{i}ZW_{j}^{T})$, and the target row totals and column totals: $V_{i}Xe_{m}^{T}=V_{i}Ye_{m}^{T}$, and $e_{n}XW_{j}^{T}=e_{n}YW_{j}^{T}$, respectively. Each problem is to be solved separately by the formula for $X_{1,1}$. The set of solutions determine $(n-1)(m-1)$ number of entries of matrix $X$. Its remaining $m+n-1$ elements are uniquely determined by the target row totals and column totals.
Next, let us see how the NM-method works if matrix $Z$ is such that the second precondition of ${\boldsymbol {{\text{LL}}(V_{i}ZW_{j}^{T})\geq 0}}$ is not met for ${\boldsymbol {\forall i,j}}$.
If ${\boldsymbol {{\text{LL}}(V_{i}ZW_{j}^{T})\leq 0}}$ for all pairs of ${\boldsymbol {i,j}}$, the solution for $X$ is also unique, deterministic, and given by a closed-form formula. However, the corresponding concept of matrix ranking is slightly different from the one discussed above. Liu and Lu (2006) define it as ${\text{LL}}^{-}(Z)={\frac {Z_{1,1}-Q^{+}(Z_{1,1})}{Q^{+}(Z_{1,1})-max(0;Z_{1,.}-Z_{.,2})}}$ , where $Z_{.,2}=Z_{1,2}+Z_{2,2}$; $Q^{+}(Z_{1,1})$ is the smallest integer being larger than or equal to $Q$.
Finally, neither the NM-method, nor ${\boldsymbol {{\text{LL}}(Z)}}$ is defined if $\exists (i,j)$ pair such that ${\boldsymbol {{\text{LL}}(V_{i}ZW_{j}^{T})>0}}$, while for another pair of $k,l(\neq i,j)$ ${\boldsymbol {{\text{ LL}}(V_{k}ZW_{l}^{T})<0}}$.

## A numerical example

Consider the following matrix $\color {green}Z$ complemented with its row totals and column totals and the targets, i.e., the row totals and column totals of matrix $\color {orange}Y$:
| Z | 1 | 2 | 3 | 4 | TOTAL | TARGET |
| 1 | 120 | 70 | 30 | 20 | 240 | 400 |
| 2 | 50 | 100 | 50 | 35 | 235 | 300 |
| 3 | 30 | 40 | 75 | 40 | 185 | 150 |
| 4 | 10 | 20 | 30 | 80 | 140 | 150 |
| TOTAL | 210 | 230 | 185 | 175 | 800 | |
| TARGET | 400 | 300 | 200 | 100 | | 1,000 |
As a first step of the NM-method, matrix $\color {green}Z$ is multiplied by the ${\boldsymbol {V_{i}}}$, and ${\boldsymbol {W_{j}^{T}}}$ matrices for each pair of $i,j$ ($i\in \{1,2,3\}$, and $j\in \{1,2,3\}$). It yields the following 9 matrices of size 2×2 with their target row totals and column totals:
| $i=1,j=1$ | 1 | 2 | TOTAL | TARGET |
| 1 | 120 | 120 | 240 | 400 |
| 2 | 90 | 470 | 560 | 600 |
| TOTAL | 210 | 590 | 800 | |
| TARGET | 400 | 600 | | 1,000 |
| $i=1,j=2$ | 1 | 2 | TOTAL | TARGET |
| 1 | 190 | 50 | 240 | 400 |
| 2 | 250 | 30 | 560 | 600 |
| TOTAL | 440 | 360 | 800 | |
| TARGET | 700 | 300 | | 1,000 |
| $i=1,j=3$ | 1 | 2 | TOTAL | TARGET |
| 1 | 220 | 20 | 240 | 400 |
| 2 | 405 | 155 | 560 | 600 |
| TOTAL | 625 | 175 | 800 | |
| TARGET | 900 | 100 | | 1,000 |
| $i=2,j=1$ | 1 | 2 | TOTAL | TARGET |
| 1 | 170 | 305 | 475 | 700 |
| 2 | 40 | 285 | 325 | 300 |
| TOTAL | 210 | 590 | 800 | |
| TARGET | 400 | 600 | | 1,000 |
| $i=2,j=2$ | 1 | 2 | TOTAL | TARGET |
| 1 | 340 | 135 | 475 | 700 |
| 2 | 100 | 225 | 325 | 300 |
| TOTAL | 440 | 360 | 800 | |
| TARGET | 700 | 300 | | 1,000 |
| $i=2,j=3$ | 1 | 2 | TOTAL | TARGET |
| 1 | 420 | 55 | 475 | 700 |
| 2 | 205 | 120 | 325 | 300 |
| TOTAL | 625 | 175 | 800 | |
| TARGET | 900 | 100 | | 1,000 |
| $i=3,j=1$ | 1 | 2 | TOTAL | TARGET |
| 1 | 200 | 460 | 660 | 850 |
| 2 | 10 | 130 | 140 | 150 |
| TOTAL | 210 | 590 | 800 | |
| TARGET | 400 | 600 | | 1,000 |
| $i=3,j=2$ | 1 | 2 | TOTAL | TARGET |
| 1 | 410 | 250 | 660 | 850 |
| 2 | 30 | 110 | 140 | 150 |
| TOTAL | 440 | 360 | 800 | |
| TARGET | 700 | 300 | | 1,000 |
| $i=3,j=3$ | 1 | 2 | TOTAL | TARGET |
| 1 | 565 | 95 | 660 | 850 |
| 2 | 60 | 80 | 140 | 150 |
| TOTAL | 625 | 175 | 800 | |
| TARGET | 900 | 100 | | 1,000 |
The next step is to calculate the generalized matrix-valued Liu-Lu index ${\text{LL}}({Z})$, (where ${\text{LL}}({Z})_{i,j}={\text{LL}}(V_{i}ZW_{j}^{T})$) by applying the formula of the original scalar-valued Liu-Lu index to each of the 9 matrices:
| ${\text{LL(Z)}}$ | $j=1$ | $j=2$ | $j=3$ |
| $i=1$ | 0.39 | 0.54 | 0.62 |
| $i=2$ | 0.53 | 0.44 | 0.47 |
| $i=3$ | 0.73 | 0.61 | 0.45 |
Apparently, matrix ${\text{LL}}(Z)$ is positive. Therefore, the NM-method is defined. Solving each of the 9 problems of the 2×2 form yields 9 entries of the $X$ matrix. Its other 7 entries are uniquely determined by the target row totals and column totals. The solution for ${\boldsymbol {X}}$ is:
| ${X}$ | 1 | 2 | 3 | 4 | TOTAL |
| 1 | 253.1 | 91.4 | 40.5 | 15.1 | 400 |
| 2 | 91.1 | 147.1 | 39.8 | 21.9 | 300 |
| 3 | 39.6 | 36.8 | 64.2 | 9.3 | 150 |
| 4 | 16.2 | 24.7 | 55.5 | 53.6 | 150 |
| TOTAL | 400 | 300 | 200 | 100 | 1,000 |

## Another numerical example taken from Abbott et al.(2019)

Consider the following matrix $\color {green}Z$ complemented with its row totals and column totals and the targets, i.e., the row totals and column totals of matrix $\color {orange}Y$:
| Z | 1 | 2 | 3 | TOTAL | TARGET |
| 1 | 1,070 | 270 | 20 | 1,360 | 1,600 |
| 2 | 300 | 4,980 | 560 | 5,840 | 5,900 |
| 3 | 20 | 420 | 2,360 | 2,800 | 2,500 |
| TOTAL | 1,390 | 5,670 | 2,940 | 10,000 | |
| TARGET | 1,390 | 5,670 | 2,940 | | 10,000 |
As a first step of the NM-method, matrix $\color {green}Z$ is multiplied by the ${\boldsymbol {V_{i}}}$, and ${\boldsymbol {W_{j}^{T}}}$ matrices for each pair of $i,j$ ($i\in \{1,2\}$, and $j\in \{1,2\}$). It yields the following 4 matrices of size 2×2 with their target row totals and column totals:
| $i=1,j=1$ | 1 | 2 | TOTAL | TARGET |
| 1 | 1,070 | 290 | 1,360 | 1,600 |
| 2 | 320 | 8,320 | 8,640 | 8,400 |
| TOTAL | 1,390 | 8,610 | 10,000 | |
| TARGET | 1,390 | 8,610 | | 10,000 |
| $i=1,j=2$ | 1 | 2 | TOTAL | TARGET |
| 1 | 1,340 | 20 | 1,360 | 1,600 |
| 2 | 5,720 | 2,920 | 8,640 | 8,400 |
| TOTAL | 7,060 | 2,940 | 10,000 | |
| TARGET | 7,060 | 2,940 | | 10,000 |
| $i=2,j=1$ | 1 | 2 | TOTAL | TARGET |
| 1 | 1,370 | 5,830 | 7,200 | 7,500 |
| 2 | 20 | 2,780 | 2,800 | 2,500 |
| TOTAL | 1,390 | 8,610 | 10,000 | |
| TARGET | 1,390 | 8,610 | | 10,000 |
| $i=2,j=2$ | 1 | 2 | TOTAL | TARGET |
| 1 | 6,620 | 580 | 7,200 | 7,500 |
| 2 | 440 | 2,360 | 2,800 | 2,500 |
| TOTAL | 7,060 | 2,940 | 10,000 | |
| TARGET | 7,060 | 2,940 | | 10,000 |
The next step is to calculate the generalized matrix-valued Liu-Lu index ${\text{LL}}({Z})$, (where ${\text{LL}}({Z})_{i,j}={\text{LL}}(V_{i}ZW_{j}^{T})$) by applying the formula of the original scalar-valued Liu-Lu index to each of the 4 matrices:
| ${\text{LL(Z)}}$ | $j=1$ | $j=2$ |
| $i=1$ | 0.75 | 0.95 |
| $i=2$ | 0.95 | 0.78 |
Apparently, matrix ${\text{LL}}(Z)$ is positive. Therefore, the NM-method is defined. Solving each of the 4 problems of the 2×2 form yields 4 entries of the $X$ matrix. Its other 5 entries are uniquely determined by the target row totals and column totals. The solution for ${\boldsymbol {X}}$ is:
| ${X}$ | 1 | 2 | 3 | TOTAL |
| 1 | 1,101 | 476 | 24 | 1,600 |
| 2 | 271 | 4,819 | 809 | 5,900 |
| 3 | 18 | 375 | 2,107 | 2,500 |
| TOTAL | 1,390 | 5,670 | 2,940 | 10,000 |

## Implementation

The NM-method is implemented in Excel, Visual Basic, R, and also in Stata.

## Applications

The NM-method can be applied to study various phenomena including assortative mating, intergenerational mobility as a type of social mobility, residential segregation, recruitment and talent management.
In all of these applications, matrices $X$, $Y$, and $Z$ represent joint distributions of one-to-one matched entities (e.g. husbands and wives, or first born children and mothers, or dwellings and main tenants, or CEOs and companies, or chess instructors and their most talended students) characterized either by a dichotomous categorical variable (e.g. taking values vegetarian/non-vegetarian, Grandmaster/or not), or an ordered multinomial categorical variable (e.g. level of final educational attainment, skiers' ability level, income bracket, category of rental fee, credit rating, FIDE titles). Although the NM-method has a wide range of applicability, all the examples to be presented next are about assortative mating along the education level. In these applications, the two preconditions (of ordered trait variable, and positive assortative mating in all educational groups) are not debated to be met.
Assume that matrix $Z$ characterizes the joint educational distribution of husbands and wives in Zimbabwe, while matrix $Y$ characterizes the same in Yemen. Matrix $X$ to be constructed with the NM-method tells us what would be the joint educational distribution of couples in Zimbabwe, if the educational distributions of husbands and wives were the same as in Yemen, while the overall desire for homogamy (also called as aggregate marital preferences in economics, or marital matching social norms/social barriers in sociology) were unchanged.
In a second application, matrices $Z$ and $Y$ characterize the same country in two different years. Matrix $Z$ is the joint educational distribution of American newlyweds in 2040, where the husbands are from Generation Z and being young adults when observed. Matrix $Y$ is the same but for Generation Y observed in year 2024. By constructing matrix $X$, one can study in the future what would be the educational distribution among the just married American young couples if they sorted into marriages the same way as the males in Generation Z and their partners do, while the education level were the same as among the males in Generation Y and their partners.
In a third application, matrices $Z$ and $Y$ characterize again the same country in two different years. In this application, matrix $Z$ is the joint educational distribution of Portuguese young couples (where the male partners' age is between 30 and 34 years) in 2011. And $Y$ is the same but it is observed in year 1981. One may aim to construct matrix $X$ in order to study what would have been the educational distribution of Portuguese young couples if they had sorted into marriages like their peers did in 2011, while their gender-specific educational distributions were the same as in 1981.
In each of the first two applications, matrix $X$ represents a counterfactual joint distribution. It can be used to quantify certain ceteris paribus effects. More precisely, to quantify on a cardinal scale the difference between the directly unobservable degree of marital sorting in Zimbabwe and Yemen, or in Generation Z and Generation Y with a counterfactual decomposition. For the decomposition, the counterfactual table $X$ is used to calculate the contribution of each of the driving forces (i.e., the observed structural availability of potential partners with various education levels determining the opportunities at the population level; and the unobservable non-structural drivers, e.g., aggregate matching preferences, desires, norms, barriers) and that of their interaction (i.e., the effect of changes in aggregate preferences/desires/norms/barriers due to changes in structural availability) to an observable cardinal scaled statistics (e.g. the share of educationally homogamous couples).
The third application was used by Naszodi and Mendonca (2021) as an example for a non-sense counterfactual: the education level has changed so drastically in Portugal over the three decades studied that this counterfactual is impossible to be obtained.

## Some features of the NM-method

First, the NM-method does not yield a meaningful solution if it reaches the limit of its applicability. For instance, in the third application, the NM-method signals with a negative entry in matrix $X$ that the counterfactual is impossible (see: AlternativeMethod_US_1980s_2010s_age3035_main.xls Sheet PT_A1981_P2011_Not_meaningful). In this respect, the NM-method is similar to the linear probability model that signals the same with a predicted probabiity outside the unit interval $[0,1]$.
Second, the NM-method commutes with merging neighboring categories of the row variable and that of the column variable: ${\text{NM}}(M_{r}Z,M_{r}Ye_{m}^{T},M_{r}e_{n}Y)=M_{r}{\text{NM}}(Z,Ye_{m}^{T},e_{n}Y)$, where $M_{r}$ is the row merging matrix of size $(n-1)\times n$; and ${\text{NM}}(ZM_{c},Ye_{m}^{T}M_{c},e_{n}YM_{c})={\text{NM}}(Z,Ye_{m}^{T},e_{n}Y)M_{c}$, where $M_{c}$ is the column merging matrix of size $m\times (m-1)$.
Third, the NM-method works even if there are zero entries in matrix $Z$.

## Comparison with the IPF

The iterative proportional fitting procedure (IPF) is also a function:${\text{IPF}}(Z,Ye_{m}^{T},e_{n}Y):\mathbb {R} ^{n\times m}\times \mathbb {R} ^{n}\times \mathbb {R} ^{m}\mapsto \mathbb {R} ^{n\times m}$. It is the operation of finding the fitted matrix ${\boldsymbol {F}}$ ($F\in \mathbb {R} ^{n\times m}$) which fulfills a set of conditions similar to those met by matrix $X$ constructed with the NM-method. E.g., matrix $F$ is the closest to matrix ${\boldsymbol {Z}}$ but with the row and column totals of the target matrix ${\boldsymbol {Y}}$.
However, there are differences between the IPF and the NM-method. The IPF defines closeness of matrices of the same size by the cross-entropy, or the Kullback-Leibler divergence. Accordingly, the IPF compatible concept of distance between the 2×2 matrices $F$ and $Z$ is zero, if their crossproduct ratios (also known as the odds ratio) are the same: ${F_{1,1}F_{2,2}}/{F_{1,2}F_{2,1}}={Z_{1,1}Z_{2,2}}/{Z_{1,2}Z_{2,1}}$. To recall, the NM-method's condition for equal ranking of matrices $X$ and $Z$ is ${\text{LL}}(X)={\frac {X_{1,1}-int[{X_{1,.}X_{.,1}}/{X_{.,.}}]}{{\text{min}}(X_{1,.},X_{.,1})-int[{X_{1,.}X_{.,1}}/{X_{.,.}}]}}={\frac {Z_{1,1}-int[{Z_{1,.}Z_{.,1}}/{Z_{.,.}}]}{{\text{min}}(Z_{1,.},Z_{.,1})-int[{Z_{1,.}Z_{.,1}}/{Z_{.,.}}]}}={\text{LL}}(Z)$.
The following numerical example highlights that the IPF and the NM-method are not identical: ${\text{IPF}}(Z,Ye_{m}^{T},e_{n}Y)\neq {\text{NM}}(Z,Ye_{m}^{T},e_{n}Y)$. Consider the matrix $\color {Green}Z$ with its targets:
| | 1 | 2 | TOTAL | TARGET |
| 1 | 450 | 150 | 600 | 1,050 |
| 2 | 50 | 350 | 400 | 450 |
| TOTAL | 500 | 500 | | |
| TARGET | 1,000 | 500 | | 1,500 |
The NM-method yields the following matrix $X$:
| $X$ | 1 | 2 | TOTAL |
| 1 | 925 | 125 | 1,050 |
| 2 | 75 | 375 | 450 |
| TOTAL | 1,000 | 500 | 1,500 |
Whereas the solution for matrix $F$ obtained with the IPF is:
| $F$ | 1 | 2 | TOTAL |
| 1 | 900 | 150 | 1,050 |
| 2 | 100 | 350 | 450 |
| TOTAL | 1,000 | 500 | 1,500 |
The IPF is equivalent to the maximum likelihood estimator of a joint population distribution, where matrix $F$ (the estimate for the joint population distribution) is calculated from matrix $Z$, the observed joint distribution in a random sample taken from the population characterized by the row totals and column totals of matrix $Y$. In contrast to the problem solved by the IPF, matrix $Z$ is not sampled from this population in the problem that the NM-method was developed to solve. In fact, in the NM-problem, matrices $Z$ and $Y$ characterize two different populations (either observed simultaneously like in the application for Zimbabwe and Yemen, or observed in two different points in time like in its application for the populations of Generation Z and Generation Y). This difference facilitates the choice between the NM-method and the IPF in empirical applications.
Deming and Stephan(1940), the inventors of the IPF, illustrated the application of their method on a classic maximum likelihood estimation problem, where matrix $Z$ was sampled from the population characterized by the row totals and column totals of matrix $Y$. They were aware of the fact that in general, the IPF is not suitable for counterfactual predictions: they explicitly warned that their algorithm is “not by itself useful for prediction” (see Stephan and Deming 1940 p. 444).
In addition, the domains are different for which the IPF and the NM-method yield solutions. First, unlike the NM-method, the IPF does not provide a solution for all seed tables ${Z}$ with zero entries (Csiszár (1975) found necessary and sufficient conditions for applying the IPF with general tables having zero entries). Second, unlike the IPF, the NM-method does not provide a meaningful solution for pairs of matrices ${Z}$ and ${Y}$ defining impossible counterfactuals. Third, the precondition of the NM-method (of either ${\boldsymbol {{\text{LL}}(Z)\geq 0}}$ or ${\boldsymbol {{\text{LL}}(Z)\leq 0}}$) is not a precondition for the applicability of the IPF.
Finally, unlike the NM, the IPF does not commute with the operation of merging neighboring categories of the row variable and that of the column variable as it is illustrated with a numerical example in Naszodi(2023) (see page 10). For this reason, the transformed table obtained with the IPF can be sensitive to the choice of the number of trait categories.
Kenneth Macdonald (2023) is at ease with the conclusion by Naszodi (2023) that the IPF is suitable for sampling correction tasks, but not for generation of counterfactuals. Similarly to Naszodi, Macdonald also questions whether the row and column proportional transformations of the IPF preserve the structure of association within a contingency table that allows us to study social mobility.

## Comparison with the Minimum Euclidean Distance Approach

The Minimum Euclidean Distance Approach (MEDA) (defined by Abbott et al., 2019 following Fernández and Rogerson, 2001) is also a function:
${\text{MEDA}}(Z,Ye_{m}^{T},e_{n}Y):\mathbb {R} ^{n\times m}\times \mathbb {R} ^{n}\times \mathbb {R} ^{m}\mapsto \mathbb {R} ^{n\times m}$.
First, MEDA assigns a scalar to matrix $Z$: it is the weight used for constructing the convex combination of two extreme cases (random and perfectly assortative matching with the pair of marginals $(Ze_{m}^{T},e_{n}Z)$) by minimizing the Eucledean distance with $Z$. E.g. this scalar is $v=0.265$ in the numerical example taken from Abbott et al.(2019). Second, for any pair of counterfactual marginal distributions ($Ye_{m}^{T},e_{n}Y$) the MEDA constructs the convex combination of the two extreme cases (random and perfectly assortative matches with the pair of marginals ($Ye_{m}^{T},e_{n}Y$)).
Differences between the NM and the MEDA: while the NM holds the assortativeness unchanged by keeping the generalized matrix-valued Liu-Lu index ${\text{LL}}({Z})$ fixed, the MEDA does the same by keeping the scalar $v$ fixed. For $Y$, and $Z$ matrices of size $2\times 2$ the two methods produces the same transformed table provided $v$ ranks the contingency tables the same as the scalar-valued Liu-Lu index does. However, for ${Z}$ matrices larger than 2×2, the generalized Liu-Lu index is matrix-valued, so it is different from the scalar-valued $v({Z})$. Therefore, the NM-transformed table is also different from the MEDA-transformed table.
For instance, in the numerical example taken from Abbott et al.(2019), the counterfactual table constructed by MEDA is the matrix $F$:
| $F$ | 1 | 2 | 3 | TOTAL |
| 1 | 1,081 | 240 | 279 | 1,600 |
| 2 | 217 | 5,054 | 629 | 5,900 |
| 3 | 92 | 376 | 2,032 | 2,500 |
| TOTAL | 1,390 | 5,670 | 2,940 | 10,000 |
The difference between matrix $F$ and matrix $X$ is not negligible. E.g. the share of homogamous couples is 2 percentage points smaller in the MEDA-constructed counterfactual matrix $F$ than in the observed matrix $Z$, whereas it is 3.4 percentage points smaller in the NM-constructed counterfactual matrix $X$ relative to $Z$.
Because Abbott's example is not a fictional one, but is based on the empirical educational distribution of American couples, therefore the difference between 2 percentage points and 3.4 percentage points can be interpreted as the MEDA quantifies changes in inequality from one generation to another generation to be significantly smaller compared to the NM.