  Let $\pi, \pi'$ be irreducible tempered representations of an affine Hecke
algebra H with positive parameters. We compute the higher extension groups
$Ext_H^n (\pi,\pi')$ explicitly in terms of the representations of analytic
R-groups corresponding to $\pi$ and $\pi'$. The result has immediate
applications to the computation of the Euler-Poincar\'e pairing $EP(\pi,\pi')$,
the alternating sum of the dimensions of the Ext-groups. The resulting formula
for $EP(\pi,\pi')$ is equal to Arthur's formula for the elliptic pairing of
tempered characters in the setting of reductive p-adic groups. Our proof
applies equally well to affine Hecke algebras and to reductive groups over
non-archimedean local fields of arbitrary characteristic. This sheds new light
on the formula of Arthur and gives a new proof of Kazhdan's orthogonality
conjecture for the Euler-Poincar\'e pairing of admissible characters.
