/playfair

The missing PHP library for mathematics and statistics

Primary LanguagePHPMIT LicenseMIT

PlayFair

Latest Version Software License Build Status Coverage Status Quality Score Total Downloads

This is where your description should go. Try and limit it to a paragraph or two, and maybe throw in a mention of what PSRs you support to avoid any confusion with users and contributors.

Install

Via Composer

$ composer require teamtnt/playfair

Usage

Linear Regression

In simple linear regression, we predict scores on one variable from the scores on a second variable. The variable we are predicting is called the criterion variable and is referred to as Y. The variable we are basing our predictions on is called the predictor variable and is referred to as X.

use TeamTNT\PlayFair\Math\Statistics\LinearRegression;

$x = [1,2,3,4,5];
$y = [1,2,1.3,3.75,2.25];

$lr = new LinearRegression;
$rez = $lr->calculate($x, $y);

$slope = $rez[0];
$intercept = $rez[1];

Testing

$ phpunit

Contributing

Please see CONTRIBUTING for details.

License

The MIT License (MIT). Please see License File for more information.