# Weighted Empirical Cumulative Distribution Function (CFD): order values before or after weighting? [before]

My input data are some observations of a continuous variable, let's say the number of kilometers of motorbikes. I did a survey and I collected some observations. Somehow, I computed weights for all observations. My dataset contains two variables:

• The number of kilometer n_km,
• The weights weight.

I want to build an empirical cumulative distribution function from these data. This way, I'll be able to say "30% of motorbikes (making the most kilometers) are making 70% of the sum of all kilometers driven by motorbikes".

The way I did it:

1. Order the observations from smaller to larger number of kilometers
2. Sum the weights starting from the observation with the largest number of kilometers, till I get 30% of the sum of all weights
3. Sum the weighted number of kilometers (weight * nb_km)

Here we are! What is important here: I order the observations before I weight them.

Someone is challenging me and telling me that I should weight first, and then order.

My justification for ordering first goes this way: A motorbike with a high number of kilometer, say 40'000 km, must be at the top of the ranking, independently of its weight. If its weight is small, say 0.2, it just means that this vehicle ist not very representative and will be grouped with more vehicles to represent some proportion of the population (say 1%).

How do I explain that we must first order, then weight? Any better examples, any theoretical justification for my challenger?