I have forgotten

• http://facebook.com/
• https://www.google.com/accounts/o8/id
• https://me.yahoo.com COST (GBP) 0.40 0.00 0

# Trim Mean

Calculates the mean of the interior of data set.
Controller: CodeCogs Contents  C++

## Trimmean

 template doubletrimmean( int n T* data double p )
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={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.