定制 kaydansky/correlation-coefficient 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

kaydansky/correlation-coefficient

Composer 安装命令:

composer require kaydansky/correlation-coefficient

包简介

A numerical measure of some type of correlation, meaning a statistical relationship between two variables.

README 文档

README

A correlation coefficient is a numerical measure of some type of correlation, meaning a statistical relationship between two variables.

A statistic used to show how the scores from one measure relate to scores on a second measure for the same group of individuals. A high value (approaching +1.00) is a strong direct relationship, a low negative value (approaching -1.00) is a strong inverse relationship, and values near 0.00 indicate little, if any, relationship.

Learn more

Features

Two types of correlation coefficient are implemented currently:

Unlimited instance number of every type's object.

Requirements

  • PHP >= 7.4.0

Installation

$ composer require kaydansky/correlation-coefficient

Basic Usage

<?php

use Correlation\{Correlation, Exception\CorrelationException};

$correlation = new Correlation();

$age = [43, 21, 25, 42, 57, 59];
$glucoseLevel = [99, 65, 79, 75, 87, 81];

try {
    var_dump($correlation->pearson($age, $glucoseLevel));
} catch (CorrelationException $e) {
    echo $e->getMessage();
}

$IQ = [106, 86, 100, 101, 99, 103, 97, 113, 112, 110];
$hoursOfTvPerWeek = [7, 0, 27, 50, 28, 29, 20, 12, 6, 17];

try {
    var_dump($correlation->spearman($IQ, $hoursOfTvPerWeek));
} catch (CorrelationException $e) {
    echo $e->getMessage();
}
  • The library provides 2 methods according to coefficient type:
$correlation->pearson($arrayX, $arrayY);
$correlation->spearman($arrayX, $arrayY);
  • Each method returns an object with 2 elements:
float|int $coefficient; // Value from -1 to 1
float|int $percentage; // Same value percentage
  • Every argument array must contain numeric values only: integer, float, numeric string.
  • Arrays pair must have equal number of elements.

License

This software is licensed under the MIT License. See the LICENSE file for details.

统计信息

  • 总下载量: 2.91k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 4
  • 点击次数: 5
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 4
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2020-01-20

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固