Evaluates the variance of the Bradford distribution PDF.

You're viewing an older version of this page (#313). View the current version.

View versions (2)

Interface

#include <codecogs/statistics/distributions/continuous/bradford/variance.h>

using namespace Statistics::Distributions::Continuous::Bradford;

This function evaluates the variance of the Bradford distribution PDF with given arguments, defined by

\sigma^2(a, b, c) = (b - a)^2 \, \frac{c (L - 2) + 2L}{2cL^2}
\qquad a < b \quad \mbox{and} \quad c > 0
(1)

where

L = \ln(c + 1)
(2)

In the example that follows, the variance is evaluated using values of the third parameter from 0.1 up to 0.8 with a step equal to 0.1, while the other two parameters have fixed values, 0 and 1. The maximum number of precision digits, implicitly set to 17, may be changed through the <em> PRECISION </em> define.

Example 1

#include <codecogs/stats/dists/continuous/bradford/variance.h>
#include <iostream>
#include <iomanip>

#define PRECISION 17

int main()
{
  std::cout << "The variance of the Bradford distribution PDF with";
  std::cout << std::endl << "a = 0, b = 1 and " << std::endl;
  std::cout << "c = {0.1, 0.2, ... , 0.7, 0.8} is" << std::endl;
  std::cout << std::endl;
  for (double c = 0.1; c < 0.81; c += 0.1)
  {
    std::cout << std::setprecision(1);
    std::cout << "c = " << std::setw(3) << c << " : ";
    std::cout << std::setprecision(PRECISION);
    std::cout << Stats::Dists::Continuous::Bradford::variance(0.0, 1.0, c);
    std::cout << std::endl;
  }
  return 0;
}

Output

The variance of the Bradford distribution PDF with
a = 0, b = 1 and
c = {0.1, 0.2, ... , 0.7, 0.8} is

c = 0.1 : 0.083320719352760711
c = 0.2 : 0.083287201579144057
c = 0.3 : 0.0832378855758278
c = 0.4 : 0.083176514926087283
c = 0.5 : 0.083105887411104279
c = 0.6 : 0.083028127878180272
c = 0.7 : 0.082944872326977309
c = 0.8 : 0.082857395191116151

Parameters

a
the first parameter of the distribution (strictly less than b)
b
the second parameter of the distribution
c
the third parameter of the distribution (strictly positive)

Returns

the variance of the Bradford distribution PDF

References

John Burkardt&#039;s library of statistical C++ routines, http://www.csit.fsu.edu/~burkardt/cpp_src/prob/prob.html

GPL Licence — free for non commercial use. See Licence details.

Interactive Calculator

a
b
c
Result