I have forgotten
my Password

Or login with:

  • Facebookhttp://facebook.com/
  • Googlehttps://www.google.com/accounts/o8/id
  • Yahoohttps://me.yahoo.com
get GPL
COST (GBP)
this unit 0.40
sub units 0.00
+
0

Trim Mean

Calculates the mean of the interior of data set.
Controller: CodeCogs

Interface

C++

Trimmean

 
template<class T> doubletrimmeanintn
T*data
doublep )
TrimMean calculates the mean taken by excluding a percentage of data points from the top and bottom tails of a data set. You can use this function when you wish to exclude outlying data from your analysis. TrimMean rounds the number of excluded data points down to the nearest multiple of 2. If percent = 0.1, 10 percent of 30 data points equals 3 points. For symmetry, TrimMean excludes a single value from the top and bottom of the data set.

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

nthe size of the array
datais the array or range of values to trim and average
pis 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.