ronkeizer / vpc

R library to create visual predictive checks (VPC)
Other
36 stars 20 forks source link

binning: take into account changes in y-direction #6

Open ronkeizer opened 10 years ago

ronkeizer commented 10 years ago

not so straightforward, so probably more a long-term thing to look into. The binning approaches (either the approaches in this package or the ones from Lavielle or Uppsala) are all suboptimal as they don't take the change in y-direction into account (i.e. areas with rapid changes in y-direction should lead to more bins in that area).

billdenney commented 3 years ago

One way that this could potentially be done is to bin by some form of smoothed derivative. To work well with something like an Emax curve it could be relatively simple to do some form of average normalized delta within an interval. For instance:

  1. Perform a rolling-derivative across all data using a relatively small number of points per interval (small = something like at least 10)
  2. Find the maximum absolute values of those rolling derivatives.
  3. Add breaks at the highest maximum, then repeat the operation again for each sub-interval that remains until you have the target number of bins. (Care will need to be taken so that there is space between bin edges so that all the edges are not sitting right on top of each other.)