This might be more of a math question, but ultimately I'd like to perform this in R. If I have a basic exponential curve, I'd like to understand how to use R to apply a series of linear functions to fit the exponential curve as best I can. The reason is the linear line is a particular relationship and the lines represent a rate of change, at each inflection point the rate of change increases. These inflection points are important for the user to know. I have a crude drawing of what I am trying to accomplish attached.
The black line is the exponential curve, the red lines are the series of linear lines, and the orange circles represent of course where the lines intersect. I can perform this task in a haphazard way by just picking arbitrary data points and building linear models until I find a combination that I feel best fits the exponential curve, but I know there is a better way than that.
Here is some code that might help:
data <- c(1:34)
sales <- c(20000000, 25000000, 30000000, 35000000, 43000000,
50000000, 57000000, 65000000, 72000000, 80000000, 89000000,
97000000, 108000000, 118000000, 128000000, 138000000, 150000000,
161000000, 174000000, 187000000, 203000000, 218000000, 235000000,
251000000, 260000000, 280000000 ,293000000, 310000000, 333000000,
363000000, 390000000, 415000000, 454000000, 540000000)
data2 <- data.frame(data,sales)
plot(data2$data,data2$sales)