Statistics › Moments ›
Trim Mean
Calculates the mean of the interior of data set.
Controller: CodeCogs
Contents
Interface
C++
Trimmean
template<class T> doubletrimmean( | int | n | |
T* | data | ||
double | p | ) |
Example 1
#include <codecogs/statistics/moments/trim_mean.h> #include <iostream> int main() { int x[8]={1, 2, 3, 4, 5, 6, 7, 8}; double tm = Stats::Moments::trimmean<int>(8, x, 0.5); std::cout << "The mean of the interior of the x array is: " << tm<< std::endl; return 0; }
Output:The mean of the interior of the x array is: 4.5
Parameters
n the size of the array data is the array or range of values to trim and average p is the fractional number of data points to exclude from the calculation
Returns
- the mean of the interior of the given data set
Authors
- Anca Filibiu (August 2005)
Source Code
Source code is available when you agree to a GP Licence or buy a Commercial Licence.
Not a member, then Register with CodeCogs. Already a Member, then Login.