Frequency
Calculates how often values occur within a given set of ranges.
Interface
#include <codecogs/statistics/moments/frequency.h>
using namespace Statistics::Moments;
Overview
This function calculates how many values in the given set of data fall within each interval of the bin array, while also calculating the number of values below and above the bin extremas. For example, use this function to count the number of test scores that fall within ranges of scores.
Example:
#include<iostream>
#include<codecogs/statistics/moments/frequency.h>
int main()
{
double
x[11]={160, 130, 100, 70, 52, 28, 27,26, 14.25, -1, -7 },
y[4]={10, 25, 40.7, 61.3};
std::vector<int> result=Stats::Moments::frequency(11,x,4,y);
std::cout<<"The corresponding frequencies for the x array are:";
std::cout<<std::endl;
for(int i=0; i<result.size(); i++)
std::cout<<result[i]<<" ";
std::cout<<std::endl;
return 0;
}Output:
The corresponding frequencies for the x array are:
2 1 3 1 4i.e. 6 numbers in total fall outside the designated range
Parameters
Returns
Members of Frequency
CLASS MEMBER
m_delta
CLASS MEMBER
m_N
CLASS MEMBER
m_num
CLASS MEMBER
m_count
CLASS METHOD
Frequency
Establishes the Frequency contains which will hold the underlying histogram of results
Parameters
CLASS METHOD
add
CLASS METHOD
reset
CLASS METHOD
get_count
CLASS METHOD
get_x
Returns the coordinate of middle of each bin:
where is the width of each bin equal to max value minus the min value divided by the number of bins.
Parameters
CLASS METHOD