How about this?
UA has "X" number of flights per year, totalling "Y" number of miles. Total expenses for the year is "Z". Therefore cost per mile is "Z"/"Y".
Take the flight you are asking about, and multiply the number of miles by the above factor.
This approach actually factors in everything, and does "subsidizing" of everything, and doesn't take into account special factors like unusually high gate expenses at certain locations, etc.
However, in the grand big picture kind of view, it all averages out.