Marketing has next to nothing to do with R&D because most R&D is accomplished before market entry of a drug.
It looks as if revenues of one drug fuel investment into new drugs, and that may be true but it is misleading. There are a lot more sources of capital than just one particular companies own revenues.
Margins and marketing budget allow us to assume significant market power in favor of the pharma companies.