Finding a Formula to Fit Data Points
Date: 06/23/2004 at 21:55:40 From: Kaylon Subject: How to fit a formula to predetermined amounts Dear Dr. Math, I need to develop a pay scale for companies that buy our product. It needs to be exponential and level off at a certain dollar amount (or close to it). For example, if the customer buys 500 items, they get $150 credit. If they buy 1000 items, they get $200 credit. And, if they buy 1500 items, they get $225 credit. How do I figure out the formula to make this work?
Date: 06/23/2004 at 23:10:24 From: Doctor Peterson Subject: Re: How to fit a formula to predetermined amounts Hi, Kaylon. I'm not sure what you mean by "exponential", but you probably have in mind something with a horizontal asymptote, like 1 - e^(-x) which would approach 1 from below. A simpler type of equation would be 1 - 1/x, which has the same characteristic. The details, of course, seem to be entirely arbitrary. Let's take your specific example. You want it to look like this: 300+ | | | 250+ | | * | 200+ * | | | 150+ * | | | 100+ | | | 50+ | | | *-------+-------+-------+ 0 500 1000 1500 How closely can we match that with a simple equation? It would be nice if we knew what the asymptotic value should be; can we determine it from the data? If we take my proposed form y = 1 - 1/x we have a little problem, since it is undefined at x = 0. Instead, I'll try this: y = a - b/(x + c) Now we have three parameters to determine, which requires only three data points. Taking (0,0), (500,150), and (1000, 200), we have 0 = a - b/c 150 = a - b/(c + 500) 200 = a - b/(c + 1000) Subtracting the first from the other two, we eliminate a: 150 = b(1/c - 1/(c + 500)) 200 = b(1/c - 1/(c + 1000)) These simplify to 150c(c + 500) = 500b 200c(c + 1000) = 1000b Setting twice the first equal to the second, we eliminate b: 300(c^2 + 500c) = 200(c^2 + 1000c) which gives 100c^2 = 50000c c = 500 and then b = 200c(c + 1000)/1000 = 500*1500/5 = 150,000 a = b/c = 150000/500 = 300 so our formula is y = a - b/(x + c) = 300 - 150,000/(x + 500) (Drum roll ...) What do we get for x = 1500? y = 300 - 150,000/2000 = 300 - 75 = 225 which happens to be just what you were hoping for! It didn't have to work out that nicely, but this suggests that my formula pretty well matches your expectations. It will approach y = 300 asymptotically, so that no one will ever get more than $300 back. If you have any further questions, feel free to write back. - Doctor Peterson, The Math Forum http://mathforum.org/dr.math/
Search the Dr. Math Library:
Ask Dr. MathTM
© 1994-2013 The Math Forum