Most of this answer is based on First-Year Wilkinson Microwave Anisotropy Probe (WMAP) Observations: Implications For Inflation. As I am not an expert in this area, I am more transcribing the computation rather than interpreting it.
The tensor/scalar ratio is given by:
$$r \equiv \frac{\Delta^{2}_{h}(k_{0})}{\Delta^{2}_{\mathcal{R}}(k_{0})}$$
Where the scalar power spectrum is:
$$\Delta^{2}_{\mathcal{R}}(k) \equiv \frac{k^{3}}{(2\pi^{2})\langle|\mathcal{R}_{k}|^{2}\rangle}$$
and the tensor power spectrum is:
$$\Delta^{2}_{h}(k) \equiv \frac{k^{3}}{(2\pi^{2})\langle|h_{+k}|^{2}+|h_{\times k}|^{2}\rangle}$$
$\mathcal{R}$ is the "curvature perturbation in the comoving gauge"
$h_{+k}$ and $h_{\times k}$ are the "two polarization states of the primordial tensor perturbation"
The spectra are parameterized by:
$$\Delta^{2}_{\mathcal{R}}(k) = \Delta^{2}_{\mathcal{R}}(k_{0}) \left(\frac{k}{k_{0}}\right)^{n_{s}(k_{0})-1+\frac{1}{2}\frac{dn_{s}}{d\ln k}\ln(\frac{k}{k_{0}})}$$
$$\Delta^{2}_{h}(k) = \Delta^{2}_{h}(k_{0}) \left(\frac{k}{k_{0}}\right)^{n_{s}(k_{0})+\frac{1}{2}\frac{dn_{t}}{d\ln k}\ln(\frac{k}{k_{0}})}$$
$\Delta^{2}_{\mathcal{R}}(k_{0})$ and $\Delta^{2}_{h}(k_{0})$ are normalization constants and $k_{0}$ is a "pivot wavenumber."