I am trying to make a graph on the Total Variation Distance between the Law of the number of Fixed Points of a Random Permutation and the Poisson($\lambda = 1$) distribution. I know that the Total Variation distance is given by ${ ||\mu - \upsilon ||_{TV} } = \frac{1}{2}{\sum_{x \in \Omega} |\mu(x)-\upsilon(x)|}$ or, equivalently by the $max_{x \subseteq \Omega}|\mu(x)-\upsilon(x)|$.
Actually I should make a graph by sampling something (that I do not understand what, yet) where it is possible to see that the TV decrease as N goes to infinity and that the TV curve stays below a bound that is given by $\frac{2^{N+1}}{(N+1)!}$. Here is the formula to obtain the law of the number of fixed points in a random permutation $\pi(x) = {\displaystyle \frac{1}{x!} \sum _{k=0}^{n-x} \frac{{(-1)}^{k}}{k!}}$
I tried to plot something on R but I was told that it was very wrong because I set on the x axis the number of elements to permutate (n) and on the y axis the distance between $\pi$ and pois(1). I understand that I was wrong because I plotted the sigle difference over n and not the sum over all sets, but I do not how I can find all this sets by sampling.
Well, I am very confused because I do not understand how and what I should sample to estimate the TV so any suggestions, comments or corrections to help me to understand it better will be very useful (also only related to the theory). I hope I explained me decently. Thank you very much
Here is an attempt to find these total variation distances empirically through simulation (100,000 cases each time) and theoretically for permutations of $n$ numbers from $1$ to $20$.
Various notes:
Some useful functions:
The main run with a seed for replication:
Visualising these results (empirical with black o, theoretical with red +, and suggest bound with a blue line) with a log-scale for the total variation distance