# Using KDE to approximate a Price vs Quantity curve

I am trying to approximate Price-vs-Quantity (P-Q) curve of a dynamic product (think Hotels, Airlines etc). As you can imagine, if you take a hotel property, the price of rooms (assuming the same room category) changes based on demand dynamically. The historical data will have several price points versus quantity remaining and I am trying to approximate this P-Q graph.

One approach that I am trying is, to use the KDE plot and choose a reasonable bandwidth that is neither too noisy nor too simplistic. Is it a terrible idea to use KDE for this purpose and do sampling from that KDE distribution?

The KDE is a nonparametric method, thus you don't provide any domain knowledge to the model, other than some degree of smoothness via the bandwidth.

If you do have any domain knowledge, like e.g. that the price goes down with increasing quantity over a certain interval, you might consider fitting a parametric model like simple linear models or more complex ones like e.g. mixed-effect GLMs. This might have the advantage that you can interpret the results better, so your fitting is not only useful for prediction but also gives you inside into the patterns in your data. Also, predictions like extrapolation are usually better with parametric than with nonparametric models. E.g. KDE, since the kernels "go down" eventually, will always extrapolate to zero outside your data.

Having said this, it is definitely not a "terrible idea" to try KDE: if you have enough data, you should give it a try. After all, the trend in machine learning goes to nonparametric models (e.g. deep neural networks) and people have a lot of success with those.

• Deep neural networks aren't nonparametric stats.stackexchange.com/q/322049/35989
– Tim
Sep 9, 2022 at 5:48
• Thanks much @frank. Is there any thumb rule on how much of historical data is required to reasonably trust sample the data from KDE? Sep 9, 2022 at 5:57
• @Tim They have so incredibly many parameters that, for most purposes, they can be considered nonparametric. Sep 9, 2022 at 5:57
• @sharathnatraj This varies strongly. You could try to find out yourself by doing some cross-validation. Sep 9, 2022 at 6:03
• Ah that makes sense! I could use a 10 or 20 fold CV and check for consistency in results using some statistical measure? Repeat that for different KDE bandwidths and chose one of the reasonable bandwidth values as my final one. Sep 9, 2022 at 6:09