mnshankar/linear-regression
最新稳定版本:1.0
Composer 安装命令:
composer require mnshankar/linear-regression
包简介
PHP package for computation of simple linear regression parameters
README 文档
README
Simple Linear Regression
This package is used to compute simple linear regression parameters using PHP. It can be used to closely mimic the output of excel regression computation add-in. For a good how-to and intro if you are unfamiliar with this feature see Excel-easy's regression example.
Installation
Add the LinearRegression package as a dependency to your composer.json file:
{
"require": {
"mnshankar/linear-regression": "1.0.*"
}
}
Using the tool
The unit tests (in the tests folder) contain a wealth of information regarding the API. Basically, you load up the X and Y columns (from arrays or a CSV) and run the compute() method to generate all the regression parameters :-)
$reg = new \mnshankar\LinearRegression\Regression(); $reg->setX($this->getXForTesting()); $reg->setY($this->getYForTesting()); $reg->compute();
Note: To account for the intercept, the first element of all X arrays is forced to be 1.
Please refer to the Excel workbook named "Regression_Verification.xlsx" in the tests folder. The worksheet named "Calculated Values" contains all parameters generated by the excel add-in using data in the worksheet named "Raw Data".
The unit tests for regression computation tests/RegressionTest.php verifies that this
same data is generated by the PHP package.
统计信息
- 总下载量: 22.49k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 24
- 点击次数: 3
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2015-02-24