Sorry if this is a naive question, but I only started using R last week. I would like to fit a distribution to data which includes a cumulative sum: P(r) = \sum^{V}_{i=r} D e^{-n/i} i^{-d} This equation is used to fit rank-frequency data: P(r) is the frequency of an entity with rank r; V is the number of unique entity types; and D, n and d are constants to be estimated. I've found out how to fit nonlinear distributions generally (using nls) but I don't know how to include the cumulative sum in the formula. Could anyone help me? Many thanks, Andrew Wilson