I'm trying to brainstorm ways to calculate a solution (in js) to the following scenario:
Say I'm given a standard timeseries with a decent amount of variance (e.g. https://codepen.io/quirkules/pen/wvBYarM). These timeseries will change based on the data set.
Example data:
var data = [
{
"date": "30/04/2012", // DD/MM/YYYY
"close": 14
},
{
"date": "1/05/2012",
"close": 2
},
{
"date": "2/05/2012",
"close": 14
},
{
"date": "3/05/2012",
"close": 5
},
{
"date": "4/05/2012",
"close": 14
}
I want to be able to identify the correct Y value that will be exceeded X % of the time. For example, if the range of dates were 50 days, and I wanted to know what value will be exceeded 50% of the time, that would mean this Y value is exceeded for a total of 25 days.
Note: depending on the nature of the dataset, this might need to be the 'closest value' to the desired Y value. Taking the previous example again, the constraints of a graph might mean we can only find a Y value that is exceeded 40% of the time through best efforts.
I'm assuming this would be a linear regression-type of problem, but I haven't used it in this way before. I'm also not sure if this can be solved using pure JS or using another library (e.g. tensorflow) but I'd be open to ideas.
Any assistance would be appreciated