piercemcgeough/phpquartiles

PHP包,用于根据数值数组计算四分位数及其位置

v1.0.0 2017-01-27 13:05 UTC

This package is not auto-updated.

Last update: 2024-09-23 04:12:48 UTC


README

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

PHP包,用于根据数值数组计算四分位数及其位置。

phpquartiles将返回第1、第2和第3四分位数。然后,您还可以找到给定分数的四分位数位置。

安装

通过Composer

$ composer require PierceMcGeough/phpquartiles

用法

$scoresArray = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15];
$quartiles = new PierceMcGeough\phpquartiles\Quartile();

四分位数命令

$quartiles->getAllQuartiles();
/**
 *  returns
 *
 *  [
 *      [q1] => 4
 *      [q2] => 8
 *      [q3] => 12
 *  ]
 */


$quartiles->getFirstQuartile();
/**
 *  returns
 *
 *  4
 */


$quartiles->getMedianQuartile();
/**
 *  returns
 *
 *  8
 */


$quartiles->getSecondQuartile();
/**
 *  alias of getMedianQuartile()
 *  returns
 *
 *  8
 */


$quartiles->getThirdQuartile();
/**
 *  returns
 *
 *  12
 */

位置命令

$quartiles->getPlacement(15);
/**
 *  returns
 *
 *  HIGHEST_QUARTILE
 */


$quartiles->getPlacementInverse(15);
/**
 *  returns
 *
 *  LOWEST_QUARTILE
 */

变更日志

有关最近变更的更多信息,请参阅变更日志

测试

$ composer test

贡献

有关详细信息,请参阅贡献指南行为准则

安全

如果您发现任何安全问题,请通过电子邮件pmcgeough@hotmail.co.uk联系,而不是使用问题跟踪器。

鸣谢

许可

MIT许可(MIT)。有关更多信息,请参阅许可文件