Let $S$ be the set of $n!$ permutations of the first $n$ integers. Let $p\in(0,1)$. Consider the Markov Process defined on the elements of $S$.


1. Let $x\in S$. Choose $1\le i <i+1 < n$ uniformly at random.
2. If $x\_i < x\_{i+1}$, swap $x\_i$ and $x\_{i+1}$ with probability $p$, otherwise do nothing. If $x\_i > x\_{i+1}$, swap $x\_i$ and $x\_{i+1}$ with probability $1-p$, otherwise do nothing.


This process is ergodic, because there is path between any two states with non-zero probability. It has a stationary distribution. I conjecture that the stationary distribution of $p(x)$ depends only on $p$ and on the number of mis-rankings of $x$, defined as $\sum\_{i\le j} 1\{x\_i < x\_j\}$. But am not able to prove it. I also wonder whether this simple model has been studied somewhere, maybe in Statistical Mechanics. Any literature reference is appreciated.



Stationary distribution of a Markov process defined on the space of permutations
Your conjecture is correct. In fact, provided $0 < p < 1$, the Markov process is recurrent and reversible with unique stationary distribution proportional to 
$$ \pi\_\sigma = \Bigl(\frac{p}{1-p}\Bigr)^{\ell(\sigma)},$$
where $\ell(\sigma)$ is the Coxeter length of $\sigma$. (This is the number of 'misrankings' in your question.) 


*Proof.* Suppose that $0 < p < 1$. Let $p\_{\sigma\tau}$ be the probability of a step from $\sigma \in S$ to $\tau\in S$. We solve the detailed balance equations $\pi\_\sigma p\_{\sigma\tau} = \pi\_\tau p\_{\tau\sigma}$. Suppose that 
$$\tau = \sigma\_1 \ldots \sigma\_{i+1} \sigma\_i \ldots \sigma\_n$$ 
where $1 \le i < \le n$. Then we step from $\sigma$ to $\tau$ with probability either $p/n$ or $(1-p)/n$. Explicitly,


\begin{align\*} n \pi\_\sigma p\_{\sigma\tau} &= \Bigl(\frac{p}{1-p}\Bigr)^{\ell(\sigma)} \begin{cases}
p & \text{if $\sigma\_i < \sigma\_j$} \\
1-p & \text{if $\sigma\_i > \sigma\_j$} \end{cases}\\
&= \Bigl(\frac{p}{1-p}\Bigr)^{\ell(\sigma)} \begin{cases} \frac{p}{1-p} (1-p) &\text{if $\sigma\_i < \sigma\_j$} \\ \frac{1-p}{p} p & \text{if $\sigma\_i > \sigma\_j$} \end{cases} \\
&= \Bigl(\frac{p}{1-p}\Bigr)^{\ell(\tau)} \begin{cases} 1-p & \text{if $\tau\_i > \tau\_j$} \\ p & \text{if $\tau\_i < \tau\_j$} \end{cases} \\ &= n\pi\_\tau p\_{\tau\sigma}. 
\end{align\*}
If $\tau$ is not of this form and $\tau \not= \sigma$ then $p\_{\sigma\tau} = p\_{\tau\sigma} = 0$. Hence the detailed balance equations hold. You observed in your question that there is a single communicating class of states. The walk is aperiodic because there is a positive chance of staying put at each step. Hence the invariant distribution is unique. $\quad \Box$


For completeness, suppose that $p=0$ or $p=1$ and that the walk starts at $\sigma \in S$. It is clear that if $p=0$ then after $\ell(\sigma)$ steps the walk reaches the identity permutation; if $p = 1$ then after $\binom{n}{2} - \ell(\sigma)$ steps the walk reaches the order reversing permutation $1 \mapsto n$, $2 \mapsto n-1$, $\ldots$, $n\mapsto 1$ of maximum Coxeter length. The only randomness arises from the order in which inversions are removed/added.


**Remark** In another version of the problem, we step according to a general transposition $(i,j)$ chosen uniformly at random. In this case the process is not reversible. When $n \le 3$ the invariant distribution depends only on the Coxeter length: for example if $n=3$ then, ordering permutations $123,213,132,312,231,321$, the transition matrix is


$$\frac{1}{3} \left( \begin{matrix} 3(1-p) & p & p & 0 & 0 & p \\ 1-p & 2-p & 0 & p & p & 0 \\ 1-p & 0 & 2-p & p & p & 0 \\ 0 & 1-p & 1-p & 1+p & 0 & p \\ 0 & 1-p & 1-p & 0 & 1+p & p \\ 1-p & 0 & 0 & 1-p & 1-p & 3p \end{matrix} \right). $$


A computer algebra calculation shows that the invariant distribution is proportional to $(\alpha,\beta,\beta,\gamma,\gamma,\delta)$ where $\alpha = (1-p)(6-11p+7p^2)$, $\beta = (1-p)p(8-7p)$, $\gamma = (1-p)p(1+7p)$ and $\delta = p(2-3p+7p^2)$. For $n=4$ the invariant distribution is more complicated. For example, if $p=3/4$ then the invariant probabilities for $2134$ and $1324$ are $5325/485760$ and $8749/485760$, respectively.


