kurtosis (Descriptive Statistics)


Import

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

Synopsis

 float archr_stats_kurtosis_f32(const float *first, size_t nbelem);
(1)
 double archr_stats_kurtosis_f64(const double *first, size_t nbelem);
(2)
 float archr_stats_kurtosis2_f32(const float *first, size_t nbelem, float m);
(3)
 double archr_stats_kurtosis2_f64(const double *first, size_t nbelem, double m);
(4)
 float kurtosis(const float *first, size_t nbelem);
(1)
 double kurtosis(const double *first, size_t nbelem);
(2)
 float kurtosis(const float *first, size_t nbelem, float m);
(3)
 double kurtosis(const double *first, size_t nbelem, double m);
(4)
 float kurtosis(const float *first, const float *last);
(5)
 double kurtosis(const double *first, const double *last);
(6)
 float kurtosis(const float *first, const float *last, float m);
(7)
 double kurtosis(const double *first, const double *last, double m);
(8)
template <typename Range> typename Range::value_type kurtosis(const Range& data);
(9)
template <typename Range> typename Range::value_type kurtosis(const Range& data, float m);
(10)
template <typename Range> typename Range::value_type kurtosis(const Range& data, double m);
(11)
subroutine archr_stats_kurtosis_f32(real(4) :: r, real(4), dimension(*), parameter :: first, integer(4) :: nbelem)
(1)
subroutine archr_stats_kurtosis_f64(real(8) :: r, real(8), dimension(*), parameter :: first, integer(4) :: nbelem)
(2)
subroutine archr_stats_kurtosis2_f32(real(4) :: r, real(4), dimension(*), parameter :: first, integer(4) :: nbelem, real(4) :: m)
(3)
subroutine archr_stats_kurtosis2_f64(real(8) :: r, real(8), dimension(*), parameter :: first, integer(4) :: nbelem, real(8) :: m)
(4)
def kurtosis(first):
    return r
(1)
def kurtosis(first, m):
    return r
(2)
function r = archr_stats_kurtosis(first)
(1)
function r = archr_stats_kurtosis(first, m)
(2)

Description

This function computes the 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 kurtosis of the elements in the given range using the following formula:

$$\beta_2=\mu_4/\mu_2^2$$

where \(\mu_i\) is the \(i^{th}\) central moment (and in particular, \(\mu_2\) is the variance).

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

Example

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

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

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

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

  return 0;
}

Possible Output

kurtosis(25,35,10,17,29,14,21,31) = 1.719413
kurtosis(25,35,10,17,29)          = 1.732114

kurtosis(25,35,10,17,29,14,21,31)  with m = 22.75 = 1.719413
kurtosis(25,35,10)                 with m = 23.33 = 1.500000
#include <archr/stats/kurtosis.hpp>
#include <iostream>
#include <vector>

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

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

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

  return 0;
}

Possible Output

kurtosis(25,35,10,17,29,14,21,31) = 1.71941
kurtosis(25,35,10,17,29)          = 1.73211
kurtosis(25,35,10)                = 1.5

kurtosis(25,35,10,17,29,14,21,31)  with m = 22.75 = 1.71941
kurtosis(25,35,10,17,29)           with m = 23.2  = 1.73211
kurtosis(25,35,10)                 with m = 23.33 = 1.5

Possible Output