www.mooseframework.org
Public Member Functions | Static Public Member Functions | Protected Attributes | List of all members
JohnsonSBDistribution Class Reference

A class used to generate a Johnson SB distribution. More...

#include <JohnsonSBDistribution.h>

Inheritance diagram for JohnsonSBDistribution:
[legend]

Public Member Functions

 JohnsonSBDistribution (const InputParameters &parameters)
 
virtual Real pdf (const Real &x) const override
 
virtual Real cdf (const Real &x) const override
 
virtual Real quantile (const Real &p) const override
 

Static Public Member Functions

static InputParameters validParams ()
 
static Real pdf (const Real &x, const Real &a, const Real &b, const Real &alpha_1, const Real &alpha_2)
 
static Real cdf (const Real &x, const Real &a, const Real &b, const Real &alpha_1, const Real &alpha_2)
 
static Real quantile (const Real &p, const Real &a, const Real &b, const Real &alpha_1, const Real &alpha_2)
 
static Real pdf (const Real &x, const Real &mean, const Real &std_dev)
 
static Real cdf (const Real &x, const Real &mean, const Real &std_dev)
 
static Real quantile (const Real &p, const Real &mean, const Real &std_dev)
 

Protected Attributes

const Real & _lower
 The lower location parameter, a. More...
 
const Real & _upper
 The upper location parameter, b. More...
 
const Real & _alpha_1
 The first shape parameter, alpha_1. More...
 
const Real & _alpha_2
 The second shape parameter, alpha_2. More...
 
const Real & _mean
 The mean (or expectation) of the distribution (mu) More...
 
const Real & _standard_deviation
 The standard deviation of the distribution (sigma) More...
 

Static Protected Attributes

static const std::array< Real, 6 > _a
 
static const std::array< Real, 6 > _b
 

Detailed Description

A class used to generate a Johnson SB distribution.

Definition at line 22 of file JohnsonSBDistribution.h.

Constructor & Destructor Documentation

◆ JohnsonSBDistribution()

JohnsonSBDistribution::JohnsonSBDistribution ( const InputParameters &  parameters)

Definition at line 37 of file JohnsonSBDistribution.C.

38  : NormalDistribution(parameters),
39  _lower(getParam<Real>("a")),
40  _upper(getParam<Real>("b")),
41  _alpha_1(getParam<Real>("alpha_1")),
42  _alpha_2(getParam<Real>("alpha_2"))
43 {
44 }

Member Function Documentation

◆ cdf() [1/3]

Real JohnsonSBDistribution::cdf ( const Real &  x) const
overridevirtual

Reimplemented from NormalDistribution.

Definition at line 91 of file JohnsonSBDistribution.C.

92 {
93  TIME_SECTION(_perf_cdf);
94  return cdf(x, _lower, _upper, _alpha_1, _alpha_2);
95 }

◆ cdf() [2/3]

Real JohnsonSBDistribution::cdf ( const Real &  x,
const Real &  a,
const Real &  b,
const Real &  alpha_1,
const Real &  alpha_2 
)
static

Definition at line 62 of file JohnsonSBDistribution.C.

64 {
65  if (x <= a)
66  return 0.0;
67  else if (x < b)
68  {
69  return NormalDistribution::cdf(alpha_1 + alpha_2 * std::log((x - a) / (b - x)), 0.0, 1.0);
70  }
71  else
72  return 0.0;
73 }

◆ cdf() [3/3]

Real NormalDistribution::cdf ( const Real &  x,
const Real &  mean,
const Real &  std_dev 
)
staticinherited

Definition at line 50 of file NormalDistribution.C.

51 {
52  return 0.5 * (1.0 + std::erf((x - mean) / (std_dev * std::sqrt(2.0))));
53 }

◆ pdf() [1/3]

Real JohnsonSBDistribution::pdf ( const Real &  x) const
overridevirtual

Reimplemented from NormalDistribution.

Definition at line 84 of file JohnsonSBDistribution.C.

85 {
86  TIME_SECTION(_perf_pdf);
87  return pdf(x, _lower, _upper, _alpha_1, _alpha_2);
88 }

◆ pdf() [2/3]

Real JohnsonSBDistribution::pdf ( const Real &  x,
const Real &  a,
const Real &  b,
const Real &  alpha_1,
const Real &  alpha_2 
)
static

Definition at line 47 of file JohnsonSBDistribution.C.

49 {
50  if (x <= a)
51  return 0.0;
52  else if (x < b)
53  {
54  return (alpha_2 * (b - a)) / ((x - a) * (b - x) * std::sqrt(2.0 * M_PI)) *
55  std::exp(-0.5 * Utility::pow<2>(alpha_1 + alpha_2 * std::log((x - a) / (b - x))));
56  }
57  else
58  return 0.0;
59 }

◆ pdf() [3/3]

Real NormalDistribution::pdf ( const Real &  x,
const Real &  mean,
const Real &  std_dev 
)
staticinherited

Definition at line 43 of file NormalDistribution.C.

44 {
45  return 1.0 / (std_dev * std::sqrt(2.0 * M_PI)) *
46  std::exp(-0.5 * Utility::pow<2>((x - mean) / std_dev));
47 }

◆ quantile() [1/3]

Real JohnsonSBDistribution::quantile ( const Real &  p) const
overridevirtual

Reimplemented from NormalDistribution.

Definition at line 98 of file JohnsonSBDistribution.C.

99 {
100  TIME_SECTION(_perf_quantile);
101  return quantile(p, _lower, _upper, _alpha_1, _alpha_2);
102 }

◆ quantile() [2/3]

Real JohnsonSBDistribution::quantile ( const Real &  p,
const Real &  a,
const Real &  b,
const Real &  alpha_1,
const Real &  alpha_2 
)
static

Definition at line 76 of file JohnsonSBDistribution.C.

78 {
79  const Real Z = NormalDistribution::quantile(p, 0.0, 1.0);
80  return (a + b * std::exp((Z - alpha_1) / alpha_2)) / (1.0 + std::exp((Z - alpha_1) / alpha_2));
81 }

◆ quantile() [3/3]

Real NormalDistribution::quantile ( const Real &  p,
const Real &  mean,
const Real &  std_dev 
)
staticinherited

Definition at line 56 of file NormalDistribution.C.

57 {
58  Real x = (p < 0.5 ? p : 1.0 - p);
59  Real y = std::sqrt(-2.0 * std::log(x));
60  Real sgn = (p - 0.5 < 0.0 ? -1.0 : 1.0);
61  Real Zp = sgn * (y + (_a[0] + _a[1] * y + _a[2] * Utility::pow<2>(y) +
62  _a[3] * Utility::pow<3>(y) + _a[4] * Utility::pow<4>(y)) /
63  (_b[0] + _b[1] * y + _b[2] * Utility::pow<2>(y) +
64  _b[3] * Utility::pow<3>(y) + _b[4] * Utility::pow<4>(y)));
65  return Zp * std_dev + mean;
66 }

◆ validParams()

InputParameters JohnsonSBDistribution::validParams ( )
static

Definition at line 19 of file JohnsonSBDistribution.C.

20 {
21  InputParameters params = NormalDistribution::validParams();
22  params.addClassDescription("Johnson Special Bounded (SB) distribution.");
23 
24  params.set<Real>("mean") = 0.0;
25  params.set<Real>("standard_deviation") = 1.0;
26  params.suppressParameter<Real>("mean");
27  params.suppressParameter<Real>("standard_deviation");
28 
29  params.addRequiredParam<Real>("a", "Lower location parameter");
30  params.addRequiredParam<Real>("b", "Upper location parameter");
31  params.addRequiredParam<Real>("alpha_1", "Shape parameter (sometimes called a)");
32  params.addRequiredParam<Real>("alpha_2", "Shape parameter (sometimes called b)");
33 
34  return params;
35 }

Member Data Documentation

◆ _a

const std::array< Real, 6 > NormalDistribution::_a
staticprotectedinherited
Initial value:
= {
{-0.322232431088, -1.0, -0.342242088547, -0.0204231210245, -0.0000453642210148}}

Coefficients for the rational function used to approximate the quantile

Definition at line 40 of file NormalDistribution.h.

Referenced by NormalDistribution::quantile().

◆ _alpha_1

const Real& JohnsonSBDistribution::_alpha_1
protected

The first shape parameter, alpha_1.

Definition at line 48 of file JohnsonSBDistribution.h.

Referenced by cdf(), pdf(), and quantile().

◆ _alpha_2

const Real& JohnsonSBDistribution::_alpha_2
protected

The second shape parameter, alpha_2.

Definition at line 51 of file JohnsonSBDistribution.h.

Referenced by cdf(), pdf(), and quantile().

◆ _b

const std::array< Real, 6 > NormalDistribution::_b
staticprotectedinherited
Initial value:
= {
{0.099348462606, 0.588581570495, 0.531103462366, 0.10353775285, 0.0038560700634}}

Definition at line 41 of file NormalDistribution.h.

Referenced by NormalDistribution::quantile().

◆ _lower

const Real& JohnsonSBDistribution::_lower
protected

The lower location parameter, a.

Definition at line 42 of file JohnsonSBDistribution.h.

Referenced by cdf(), pdf(), and quantile().

◆ _mean

const Real& NormalDistribution::_mean
protectedinherited

◆ _standard_deviation

const Real& NormalDistribution::_standard_deviation
protectedinherited

◆ _upper

const Real& JohnsonSBDistribution::_upper
protected

The upper location parameter, b.

Definition at line 45 of file JohnsonSBDistribution.h.

Referenced by cdf(), pdf(), and quantile().


The documentation for this class was generated from the following files:
JohnsonSBDistribution::_lower
const Real & _lower
The lower location parameter, a.
Definition: JohnsonSBDistribution.h:42
NormalDistribution::cdf
virtual Real cdf(const Real &x) const override
Definition: NormalDistribution.C:76
JohnsonSBDistribution::_alpha_1
const Real & _alpha_1
The first shape parameter, alpha_1.
Definition: JohnsonSBDistribution.h:48
NormalDistribution::_a
static const std::array< Real, 6 > _a
Definition: NormalDistribution.h:40
JohnsonSBDistribution::_upper
const Real & _upper
The upper location parameter, b.
Definition: JohnsonSBDistribution.h:45
NormalDistribution::validParams
static InputParameters validParams()
Definition: NormalDistribution.C:25
NormalDistribution::NormalDistribution
NormalDistribution(const InputParameters &parameters)
Definition: NormalDistribution.C:35
JohnsonSBDistribution::_alpha_2
const Real & _alpha_2
The second shape parameter, alpha_2.
Definition: JohnsonSBDistribution.h:51
NormalDistribution::quantile
virtual Real quantile(const Real &p) const override
Definition: NormalDistribution.C:83
JohnsonSBDistribution::cdf
virtual Real cdf(const Real &x) const override
Definition: JohnsonSBDistribution.C:91
NormalDistribution::_b
static const std::array< Real, 6 > _b
Definition: NormalDistribution.h:41
JohnsonSBDistribution::quantile
virtual Real quantile(const Real &p) const override
Definition: JohnsonSBDistribution.C:98
JohnsonSBDistribution::pdf
virtual Real pdf(const Real &x) const override
Definition: JohnsonSBDistribution.C:84