In order to develop a better understanding of the evolutionary dynamics of HIV drug resistance, it is necessary to quantify accurately the in vivo fitness costs of resistance mutations. However, the reliable estimation of such fitness costs is riddled with both theoretical and experimental difficulties. Experimental fitness assays typically suffer from the shortcoming that they are based on in vitro data. Fitness estimates based on the mathematical analysis of in vivo data, however, are often questionable because the underlying assumptions are not fulfilled. In particular, the assumption that the replication rate of the virus population is constant in time is frequently grossly violated. By extending recent work of Marée and colleagues, we present here a new approach that corrects for time–dependent viral replication in time–series data for growth competition of mutants. This approach allows a reliable estimation of the relative replicative capacity (with confidence intervals) of two competing virus variants growing within the same patient, using longitudinal data for the total plasma virus load, the relative frequency of the two variants and the death rate of infected cells. We assess the accuracy of our method using computer–generated data. An implementation of the developed method is freely accessible on the Web (http://www.eco.ethz.ch/fitness.html).