Calculate migration probability matrix from distances matrix Imagine the world-wide human populations as a series of interconnecting populations. The distances between any two populations is given by the following kind of matrix
$$
        \begin{matrix}
        D_{1,1} & D_{1,2} & D_{1,3} & D_{1,4} \\
        D_{2,1} & D_{2,2} & D_{2,3} & D_{2,4}\\
        D_{3,1} & D_{3,2} & D_{3,3} & D_{3,4} \\
        D_{4,1} & D_{4,2} & D_{4,3} & D_{4,4} \\
        \end{matrix}
$$
, where $D_{i,j}$ is the distance between population $i$ and population $j$. Of course, $D_{i,j} = 0\space \text{if}\space i=j$, that is the distance of population to itself is necessarily zero. Also, $D_{i,j} = D_{j,i}$. The matrix is therefore symmetric and the diagonal is made of zeros. In the above case I considered only 4 populations but in the model I am interested in (that is not about humans btw) there are many more populations.
I want to transform this matrix of distances into a matrix of migration rate like that
$$
        \begin{matrix}
        M_{1,1} & M_{1,2} & M_{1,3} & M_{1,4} \\
        M_{2,1} & M_{2,2} & M_{2,3} & M_{2,4}\\
        M_{3,1} & M_{3,2} & M_{3,3} & M_{3,4} \\
        M_{4,1} & M_{4,2} & M_{4,3} & M_{4,4} \\
        \end{matrix}
$$
, where $M_{i,j}$ is the probability of a given individual born in population $i$ to die in population $j$. I know three things about this matrix:


*

*Because an individual necessarily have to die somewhere, each row adds up to 1.

*I want that on average the probability for an individual to die in the same patch than where it was born is 0.9 $\left(\frac{1}{4}\sum_{i=1}^4 M_{i,i} = 0.9\right)$. If $\sum_{j=1}^4 D_{1,j} > \sum_{j=1}^4 D_{2,j}$, then $M_{1,1} > M_{2,2}$, that is if population 1 is more isolated than population 2, then an individual born in population 1 is more likely to die in population 1 than it is likely for an individual born in population 2 to die in population 2.

*For any $i≠j$, the higher is the distance $D_{i,j}$, the lower is the migration rate $M_{i,j}$. This decrease is linear and has a slope $K$.
What function can I use to calculate the matrix of migration rate from the matrix of distances? I fail to understand if there is enough information to answer this question. Let me know ideas about what kind of extra decisions I could make so to construct this matrix of migration. Thank you
 A: Let's write $n$ instead of $4$ for the number of locations.
Given you specification, the only thing you need (or can!) to decide on is the coefficients on the linear correspondence:
$$ M_{ij} = A - KD_{ij} \qquad\text{for }i\ne j$$
Once $A$ and $K$ are known, you can compute all of the off-diagonal elements of $M$, and then find the diagonal by
$$ M_{ii} = 1 - \sum_{j\ne i} M_{ij} $$
We must then have $$\sum_i M_{ii} = n - n(n-1)A + K\sum_{i,j}D_{ij} = 0.9\cdot n$$
Unfortunately this is not enough to determine what $A$ and $K$ must be. We could get the $0.9$ right by choosing $A=\frac{0.1}{n-1}$ and $K=0$, but we need $K>0$ in order to fulfill the second part of your criterion 2. It is not clear just how large $K$ should be, however, -- if you choose too large a value you would end up with negative entries in $M$, which is not meaningful. But up to that point you can simply choose your $K$ by some means not indicated in the question, and then compute $A$ as
$$ A = \frac{0.1}{n-1} + K\frac{\sum_{i,j}D_{ij}}{n(n-1)} $$
