Calculate the directional distribution from points.
$ npm i ml-directional-distribution
You can call getDirectionalEllipse on two arrays x and y containing the x and y coordinates of the points for which you want to find the directional ellipse. It is also possible to specify the number of standard deviations nbSD. If nbSD is 1, the ellipse will cover about 68% of the points, if nbSD is 2, the ellipse will cover about 95% of the points and if nbSD is 3, the ellipse will cover about 99% of the points.
The return type contains the following data:
import { getDirectionalEllipse } from 'ml-directional-distribution';
let { rMajor, rMinor, position, majorAxis, minorAxis } = getDirectionalEllipse(
{
x: [1, 2, 3, 4, 5, 6],
y: [1, 4, 2, 5, 3, 6],
},
{ nbSD: 3 },
);