https://mooseframework.inl.gov
Public Types | Public Member Functions | Static Public Member Functions | Public Attributes | Protected Member Functions | Protected Attributes | List of all members
StudentT Class Reference

A class used to generate a Student's t distribution. More...

#include <StudentT.h>

Inheritance diagram for StudentT:
[legend]

Public Types

typedef DataFileName DataFileParameterType
 

Public Member Functions

 StudentT (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
 
virtual Real median () const
 
virtual bool enabled () const
 
std::shared_ptr< MooseObjectgetSharedPtr ()
 
std::shared_ptr< const MooseObjectgetSharedPtr () const
 
MooseAppgetMooseApp () const
 
const std::string & type () const
 
virtual const std::string & name () const
 
std::string typeAndName () const
 
std::string errorPrefix (const std::string &error_type) const
 
void callMooseError (std::string msg, const bool with_prefix) const
 
MooseObjectParameterName uniqueParameterName (const std::string &parameter_name) const
 
const InputParametersparameters () const
 
MooseObjectName uniqueName () const
 
const T & getParam (const std::string &name) const
 
std::vector< std::pair< T1, T2 > > getParam (const std::string &param1, const std::string &param2) const
 
const T * queryParam (const std::string &name) const
 
const T & getRenamedParam (const std::string &old_name, const std::string &new_name) const
 
getCheckedPointerParam (const std::string &name, const std::string &error_string="") const
 
bool isParamValid (const std::string &name) const
 
bool isParamSetByUser (const std::string &nm) const
 
void paramError (const std::string &param, Args... args) const
 
void paramWarning (const std::string &param, Args... args) const
 
void paramInfo (const std::string &param, Args... args) const
 
void connectControllableParams (const std::string &parameter, const std::string &object_type, const std::string &object_name, const std::string &object_parameter) const
 
void mooseError (Args &&... args) const
 
void mooseErrorNonPrefixed (Args &&... args) const
 
void mooseDocumentedError (const std::string &repo_name, const unsigned int issue_num, Args &&... args) const
 
void mooseWarning (Args &&... args) const
 
void mooseWarningNonPrefixed (Args &&... args) const
 
void mooseDeprecated (Args &&... args) const
 
void mooseInfo (Args &&... args) const
 
std::string getDataFileName (const std::string &param) const
 
std::string getDataFileNameByName (const std::string &relative_path) const
 
std::string getDataFilePath (const std::string &relative_path) const
 
PerfGraphperfGraph ()
 
const Parallel::Communicator & comm () const
 
processor_id_type n_processors () const
 
processor_id_type processor_id () const
 

Static Public Member Functions

static InputParameters validParams ()
 
static Real pdf (const Real &x, const unsigned int &dof)
 
static Real cdf (const Real &x, const unsigned int &dof)
 
static Real quantile (const Real &p, const unsigned int &dof)
 

Public Attributes

const ConsoleStream _console
 

Protected Member Functions

PerfID registerTimedSection (const std::string &section_name, const unsigned int level) const
 
PerfID registerTimedSection (const std::string &section_name, const unsigned int level, const std::string &live_message, const bool print_dots=true) const
 
std::string timedSectionName (const std::string &section_name) const
 

Protected Attributes

const unsigned int_dof
 Degrees of freedom. More...
 
const bool & _enabled
 
MooseApp_app
 
const std::string _type
 
const std::string _name
 
const InputParameters_pars
 
Factory_factory
 
ActionFactory_action_factory
 
MooseApp_pg_moose_app
 
const std::string _prefix
 
const Parallel::Communicator & _communicator
 

Detailed Description

A class used to generate a Student's t distribution.

Definition at line 17 of file StudentT.h.

Constructor & Destructor Documentation

◆ StudentT()

StudentT::StudentT ( const InputParameters parameters)

Definition at line 24 of file StudentT.C.

25  : Distribution(parameters), _dof(getParam<unsigned int>("dof"))
26 {
27 }
Distribution(const InputParameters &parameters)
const unsigned int & _dof
Degrees of freedom.
Definition: StudentT.h:34
const InputParameters & parameters() const

Member Function Documentation

◆ cdf() [1/2]

Real StudentT::cdf ( const Real x) const
overridevirtual

Implements Distribution.

Definition at line 60 of file StudentT.C.

61 {
62  return cdf(x, _dof);
63 }
virtual Real cdf(const Real &x) const override
Definition: StudentT.C:60
const unsigned int & _dof
Degrees of freedom.
Definition: StudentT.h:34
const std::vector< double > x

◆ cdf() [2/2]

Real StudentT::cdf ( const Real x,
const unsigned int dof 
)
static

Definition at line 38 of file StudentT.C.

39 {
40  Real v = dof;
41  Real z = Beta::incompleteBeta(v / 2.0, 0.5, v / (v + x * x)) / 2.0;
42  return x > 0 ? 1.0 - z : z;
43 }
const std::vector< double > x
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
static const std::string v
Definition: NS.h:84
static Real incompleteBeta(const Real &a, const Real &b, const Real &x)
Lower incomplete beta function.
Definition: Beta.C:82

◆ pdf() [1/2]

Real StudentT::pdf ( const Real x) const
overridevirtual

Implements Distribution.

Definition at line 54 of file StudentT.C.

55 {
56  return pdf(x, _dof);
57 }
virtual Real pdf(const Real &x) const override
Definition: StudentT.C:54
const unsigned int & _dof
Degrees of freedom.
Definition: StudentT.h:34
const std::vector< double > x

◆ pdf() [2/2]

Real StudentT::pdf ( const Real x,
const unsigned int dof 
)
static

Definition at line 30 of file StudentT.C.

31 {
32  Real v = dof;
33  return std::pow((v / (v + x * x)), (1.0 + v) / 2.0) /
34  (std::sqrt(v) * Beta::betaFunction(v / 2.0, 0.5));
35 }
const std::vector< double > x
static Real betaFunction(const Real &a, const Real &b)
Beta function: B(a,b) = Gamma(a)Gamma(b)/Gamma(a+b)
Definition: Beta.C:76
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
static const std::string v
Definition: NS.h:84
MooseUnits pow(const MooseUnits &, int)

◆ quantile() [1/2]

Real StudentT::quantile ( const Real p) const
overridevirtual

Implements Distribution.

Definition at line 66 of file StudentT.C.

67 {
68  return quantile(p, _dof);
69 }
const unsigned int & _dof
Degrees of freedom.
Definition: StudentT.h:34
virtual Real quantile(const Real &p) const override
Definition: StudentT.C:66

◆ quantile() [2/2]

Real StudentT::quantile ( const Real p,
const unsigned int dof 
)
static

Definition at line 46 of file StudentT.C.

47 {
48  Real v = dof;
49  Real x = Beta::incompleteBetaInv(v / 2.0, 0.5, 2.0 * (p <= 0.5 ? p : 1.0 - p));
50  return (p <= 0.5 ? -1.0 : 1.0) * std::sqrt(v * (1 - x) / x);
51 }
static Real incompleteBetaInv(const Real &a, const Real &b, const Real &p)
Inverse of lower incomplete beta function.
Definition: Beta.C:124
const std::vector< double > x
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
static const std::string v
Definition: NS.h:84

◆ validParams()

InputParameters StudentT::validParams ( )
static

Definition at line 16 of file StudentT.C.

17 {
19  params.addClassDescription("Student t-distribution");
20  params.addRequiredRangeCheckedParam<unsigned int>("dof", "dof > 0", "Degrees of freedom.");
21  return params;
22 }
void addRequiredRangeCheckedParam(const std::string &name, const std::string &parsed_function, const std::string &doc_string)
static InputParameters validParams()
void addClassDescription(const std::string &doc_string)

Member Data Documentation

◆ _dof

const unsigned int& StudentT::_dof
protected

Degrees of freedom.

Definition at line 34 of file StudentT.h.

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


The documentation for this class was generated from the following files: