kurtosis (sampled) (Descriptive Statistics)


Import

#include <archr/stats/sample_kurtosis.h>
#include <archr/stats/sample_kurtosis.hpp>
import archr.stats
atomsLoads('archr')

Synopsis

 float archr_stats_sample_kurtosis_f32(const float *first, size_t nbelem);
(1)
 double archr_stats_sample_kurtosis_f64(const double *first, size_t nbelem);
(2)
 float archr_stats_sample_kurtosis2_f32(const float *first, size_t nbelem, float m);
(3)
 double archr_stats_sample_kurtosis2_f64(const double *first, size_t nbelem, double m);
(4)
 float sample_kurtosis(const float *first, size_t nbelem);
(1)
 double sample_kurtosis(const double *first, size_t nbelem);
(2)
 float sample_kurtosis(const float *first, size_t nbelem, float m);
(3)
 double sample_kurtosis(const double *first, size_t nbelem, double m);
(4)
 float sample_kurtosis(const float *first, const float *last);
(5)
 double sample_kurtosis(const double *first, const double *last);
(6)
 float sample_kurtosis(const float *first, const float *last, float m);
(7)
 double sample_kurtosis(const double *first, const double *last, double m);
(8)
template <typename Range> typename Range::value_type sample_kurtosis(const Range& data);
(9)
template <typename Range> typename Range::value_type sample_kurtosis(const Range& data, float m);
(10)
template <typename Range> typename Range::value_type sample_kurtosis(const Range& data, double m);
(11)
subroutine archr_stats_sample_kurtosis_f32(real(4) :: r, real(4), dimension(*), parameter :: first, integer(4) :: nbelem)
(1)
subroutine archr_stats_sample_kurtosis_f64(real(8) :: r, real(8), dimension(*), parameter :: first, integer(4) :: nbelem)
(2)
subroutine archr_stats_sample_kurtosis2_f32(real(4) :: r, real(4), dimension(*), parameter :: first, integer(4) :: nbelem, real(4) :: m)
(3)
subroutine archr_stats_sample_kurtosis2_f64(real(8) :: r, real(8), dimension(*), parameter :: first, integer(4) :: nbelem, real(8) :: m)
(4)
def sample_kurtosis(first):
    return r
(1)
def sample_kurtosis(first, m):
    return r
(2)
function r = archr_stats_sample_kurtosis(first)
(1)
function r = archr_stats_sample_kurtosis(first, m)
(2)

Description

This function computes the bias-corrected kurtosis of the elements stored in:

Parameters

first

the beginning of the range of elements to process.

last

the end of the range of elements to process.

nbelem

the number of elements to process.

m

the mean of the range of elements.

Return value

The bias-corrected kurtosis of a population of n samples using the following formula:

$$\beta_2(n) = \frac{n-1}{(n-2)(n-3)} (\frac{(n+1)\mu_4}{\mu_2^2} - 3(n-1)) + 3$$

If m is not provided, the mean of the elements range is computed beforehand.

Example

#include <archr/stats/sample_kurtosis.h>
#include <stdio.h>

int main()
{
  float v[] = {25, 35, 10, 17, 29, 14, 21, 31};

  printf("sample_kurtosis(25,35,10,17,29,14,21,31) = %f\n", archr_stats_sample_kurtosis_f32(&v[0],8));
  puts("");

  printf("sample_kurtosis(25,35,10,17,29,14,21,31)  with m = 22.75 = %f\n", archr_stats_sample_kurtosis2_f32(&v[0],8,22.75));

  return 0;
}

Possible Output

sample_kurtosis(25,35,10,17,29,14,21,31) = 1.710768
sample_kurtosis(25,35,10,17,29)          = 1.928455

sample_kurtosis(25,35,10,17,29,14,21,31)  with m = 22.75 = 1.710768
sample_kurtosis(25,35,10)                 with m = 23.33 = -nan
#include <archr/stats/sample_kurtosis.hpp>
#include <iostream>
#include <vector>

int main()
{
  std::vector<float> v{25, 35, 10, 17, 29, 14, 21, 31};

  std::cout << "sample_kurtosis(25,35,10,17,29,14,21,31) = " << archr::stats::sample_kurtosis(v) << "\n";
  std::cout << "sample_kurtosis(25,35,10,17,29)          = " << archr::stats::sample_kurtosis(v.data(), 5) << "\n";
  std::cout << "sample_kurtosis(25,35,10)                = " << archr::stats::sample_kurtosis(v.data(), v.data() + 3) << "\n";
  std::cout << "\n";

  std::cout << "sample_kurtosis(25,35,10,17,29,14,21,31)  with m = 22.75 = " << archr::stats::sample_kurtosis(v,22.75) << "\n";
  std::cout << "sample_kurtosis(25,35,10,17,29)           with m = 23.2  = " << archr::stats::sample_kurtosis(v.data(), 5, 23.2f) << "\n";
  std::cout << "sample_kurtosis(25,35,10)                 with m = 23.33 = " << archr::stats::sample_kurtosis(v.data(), v.data() + 3, 23.33333f) << "\n";

  return 0;
}

Possible Output

sample_kurtosis(25,35,10,17,29,14,21,31) = 1.71077
sample_kurtosis(25,35,10,17,29)          = 1.92846
sample_kurtosis(25,35,10)                = -nan

sample_kurtosis(25,35,10,17,29,14,21,31)  with m = 22.75 = 1.71077
sample_kurtosis(25,35,10,17,29)           with m = 23.2  = 1.92846
sample_kurtosis(25,35,10)                 with m = 23.33 = -nan

Possible Output