I have come across a Q&A about the calculation of the duration of an interest rate swap on this site.
In the Q&A, the derivative is calculated as:
$\frac{\partial PV}{\partial r}=t_nD(t_n)+q\sum_j\Delta_j^{fix} t_jD(t_j)$.
I don't understand what $r$ is in the equation above? Shouldn't the derivative be calculated as $\frac{\partial PV}{\partial q}$, assuming $q$ is the swap rate?
I have also read somewhere that sensitivity of an interest rate swap w.r.t. its swap rate is approximately life of the swap.
So, I should expect that $\frac{\partial PV}{\partial q}\approx t_n$, but it is stated in that Q&A that $\frac{\partial PV}{\partial r}\approx t_n$. Are they both equal? If they are indeed equal, why so?