Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Frequency distribution of grouped data #369

Open
stevensgsp opened this issue Feb 12, 2020 · 3 comments
Open

Frequency distribution of grouped data #369

stevensgsp opened this issue Feb 12, 2020 · 3 comments

Comments

@stevensgsp
Copy link

Not an issue - just a question
Is there a function in your library that can get Frequency distribution of grouped data?

This is, return data to fill a Frequency Distribution table of grouped data.
Calculating class intervals, interval width (indicating the interval width), mean for grouped data, median for grouped data and mode for grouped data.

This links explains what I mean:
https://www.onlinemathlearning.com/make-frequency-table.html
https://www.toppr.com/guides/maths/statistics/frequency-distribution/

Thanks!

@markrogoyski
Copy link
Owner

Hi @stevensgsp,

Thanks for your interest in MathPHP.

Currently there are basic frequency distributions. You can use them like this:

use MathPHP\Statistics\Distribution;

$grades = ['A', 'A', 'B', 'B', 'B', 'B', 'C', 'C', 'D', 'F'];

// Frequency distributions (frequency and relative frequency)
$frequencies          = Distribution::frequency($grades);         // [ A => 2,   B => 4,   C => 2,   D => 1,   F => 1   ]
$relative_frequencies = Distribution::relativeFrequency($grades); // [ A => 0.2, B => 0.4, C => 0.2, D => 0.1, F => 0.1 ]

// Cumulative frequency distributions (cumulative and cumulative relative)
$cumulative_frequencies          = Distribution::cumulativeFrequency($grades);         // [ A => 2,   B => 6,   C => 8,   D => 9,   F => 10  ]
$cumulative_relative_frequencies = Distribution::cumulativeRelativeFrequency($grades); // [ A => 0.2, B => 0.6, C => 0.8, D => 0.9, F => 1   ]

If there is something more you think would be useful, please let us know and describe what the input and output would be. If there are other libraries where this is implemented as a reference, like R or Excel, for example, that is useful too.

Thanks,
Mark

@stevensgsp
Copy link
Author

Hello,

Thanks for your quick response.

I'm going to prepare description of input and output.

In any case, I will surely develop this functionality since I need it, so I could give you that.

@markrogoyski
Copy link
Owner

Hi @stevensgsp,

Any update on this? If you can provide some example input and output?

Thanks,
Mark

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants