PHP Class MathPHP\Statistics\Regression\TheilSen

A method for robustly fitting a line to a set of points (simple linear regression) that chooses the median slope among all lines through pairs of two-dimensional sample points. https://en.wikipedia.org/wiki/Theil%E2%80%93Sen_estimator
Inheritance: extends ParametricRegression, use trait MathPHP\Statistics\Regression\Models\LinearModel
Show file Open project: markrogoyski/math-php

Public Methods

Method Description
calculate ( ) Calculate the regression parameters using the Theil-Sen method

Method Details

calculate() public method

Procedure: Calculate the slopes of all pairs of points and select the median value Calculate the intercept using the slope, and the medians of the X and Y values. b = Ymedian - (m * Xmedian)
public calculate ( )