General--Interpolation and NonlinearFit
- To: mathgroup at smc.vnet.net
- Subject: [mg62241] General--Interpolation and NonlinearFit
- From: dwstrickler at comcast.net
- Date: Thu, 17 Nov 2005 04:15:39 -0500 (EST)
- Sender: owner-wri-mathgroup at wolfram.com
I apologize if this has already been addressed; I looked but didn't see it.<br><br> I have a large dataset of ordered pairs that represent the distance between two particular domestic airline markets, and the average revenue per available seat mile ($RASM) for that segment. Here's a 10% sample:<br><br> In: trunc = {{164, 0.828125}, {511, 0.239193}, {773, 0.161701}, {929, 0.304897}, { 1002, 0.165}, {1037, 0.0613953}, {1071, 1.0047}, {1129, 0.144796}, { 1226, 0.115796}, {1275, 0.521301}, {1355, 0.0872033}, {1445, 0.147997}, {1525, 0.250803}, {1610, 0.0692973}, {1631, 0.1673}, {1645, 0.142502}, {1753, 0.138701}, {1802, 0.0861022}, {1854, 0.124698}, {1948, 0.127205}, {2016, 0.1557}, {2085, 0.0909986}, {2120, 0.316799}, {2140, 0.104899}, {2270, 0.0720988}, {2430, 0.1031}, {2557, 0.0369996}, {2588, 0.0541983}, {4618, 0.0886993}, {788, 0.214494}, {978, 0.148804}, {1103, 0.112796}, {1285, 0.105402}, {1399, 0.0903011}, {1527, 0.1181}, {1650, 0.131498}, {1824, 0.148002}, {1946, 0.0878012}, {2087, 0.0747}, {2198, 0.061299}, {2506, 0.0438015}, {2631, 0.056418}, {446, 0.781509}, {960, 0.292395}, {1134, 0.151403}, {1352, 0.172999}, {1621, 0.238701}, {1784, 0.179701}, {2090, 0.0541016}, {2503, 0.061499}, {797, 0.508297}, {1164, 0.103798}, {1676, 0.132201}, {1996, 0.0692975}, {2359, 0.0564019}, {2829, 0.0324991}, {1154, 0.106197}, {1808, 0.174302}, {2326, 0.0621988}, {5151, 0.088301}, {1089, 0.121501}, {1940, 0.105502}, {2558, 0.0386996}, {1143, 0.123398}, {2721, 0.0596982}, {1018, 0.701296}, {821, 0.166103}, {2833, 0.110699}, {2109, 0.1042}, {2525, 0.0519008}, {3034, 0.0741004}, {643, \ 0.216593}, {569, 0.371894}, {205, 0.4525}, {3908, 0.1251}, {335, 0.418889}, {5156, 0.0568005}, {3934, 0.121501}};<br> Using NonlinearFit, I already discovered that a Hoerl distribution (y = a/(b^x)(x^c)) offers a reasonably good fit even without scrubbing the data. But if it's possible to do such a thing, I'd like to do a nonlinear regression using the interpolation function Mathematica came up with (itrunc) - just for comparison purposes if nothing else.<br><br> It's my understanding that the default setting for Interpolation assumes a third degree polynomial, so I tried the following:<br><br> In: itrunc = Interpolation[trunc]<br><br> Out: InterpolatingFunction[{{164., 3934.}}, "<>"]<br><br> In: NonlinearRegress[trunc, itrunc, x, {a, b, c}]<br><br> which yielded this error message:<br><br> Out: NonlinearRegress::"nonnum": "The model is not numerical at \!\({\(\(a -> \ 1\)\), \(\(b -> 1\)\), \(\(c -> 1\)\), \(\(x -> 164.`\)\)}\). Check that all \ model parameters are included in the parameter list."<br><br> To my undoubtedly naive way of thinking, there HAS to be a way to: (1) tell Mathematica that my paired data runs from {xi, yi} to {xn, yn}; (2) have Mathematica derive an interpolation function that is a least-squares estimate in relation to the sample; (3) tell Mathematica to hold (if not return) the function (no matter how ugly it is); and (4) be able to work with the resulting interpolation function just as I could work with the Hoerl distribution or any other nonlinear function that the data fit.<br><br> Can someone please tell me - is this a case of bad programming syntax on my part, or is what I'm asking for a mathematical non-sequitur? Thanks.<br><br> Link to the forum page for this post: http://www.mathematica-users.org/webMathematica/wiki/wiki.jsp?pageName=Special:Forum_ViewTopic&pid=6054#p6054 Posted through http://www.mathematica-users.org [[postId=6054]]