https://mooseframework.inl.gov
Logistic.C
Go to the documentation of this file.
1 //* This file is part of the MOOSE framework
2 //* https://mooseframework.inl.gov
3 //*
4 //* All rights reserved, see COPYRIGHT for full restrictions
5 //* https://github.com/idaholab/moose/blob/master/COPYRIGHT
6 //*
7 //* Licensed under LGPL 2.1, please see LICENSE for details
8 //* https://www.gnu.org/licenses/lgpl-2.1.html
9 
10 #include "Logistic.h"
11 #include "math.h"
12 #include "libmesh/utility.h"
13 
14 registerMooseObject("StochasticToolsApp", Logistic);
15 
18 {
20  params.addClassDescription("Logistic distribution.");
21  params.addRequiredParam<Real>("location", "Location or mean of the distribution (alpha or mu)");
22  params.addRequiredParam<Real>("shape", "Shape of the distribution (beta or s)");
23  return params;
24 }
25 
27  : Distribution(parameters), _location(getParam<Real>("location")), _shape(getParam<Real>("shape"))
28 {
29 }
30 
31 Real
32 Logistic::pdf(const Real & x, const Real & location, const Real & shape)
33 {
34  Real z = std::exp(-(x - location) / shape);
35  return z / (shape * Utility::pow<2>(1.0 + z));
36 }
37 
38 Real
39 Logistic::cdf(const Real & x, const Real & location, const Real & shape)
40 {
41  Real z = std::exp(-(x - location) / shape);
42  return 1.0 / (1.0 + z);
43 }
44 
45 Real
46 Logistic::quantile(const Real & p, const Real & location, const Real & shape)
47 {
48  return location - shape * std::log(1.0 / p - 1.0);
49 }
50 
51 Real
52 Logistic::pdf(const Real & x) const
53 {
54  return pdf(x, _location, _shape);
55 }
56 
57 Real
58 Logistic::cdf(const Real & x) const
59 {
60  return cdf(x, _location, _shape);
61 }
62 
63 Real
64 Logistic::quantile(const Real & p) const
65 {
66  return quantile(p, _location, _shape);
67 }
const Real & _shape
The shape of the distribution (beta or s)
Definition: Logistic.h:37
void addRequiredParam(const std::string &name, const std::string &doc_string)
const std::vector< double > x
virtual Real quantile(const Real &p) const override
Definition: Logistic.C:64
static InputParameters validParams()
Definition: Logistic.C:17
const Real & _location
The location or mean of the distribution (alpha or mu)
Definition: Logistic.h:34
virtual Real cdf(const Real &x) const override
Definition: Logistic.C:58
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
static InputParameters validParams()
void addClassDescription(const std::string &doc_string)
A class used to generate a logistic distribution.
Definition: Logistic.h:17
Logistic(const InputParameters &parameters)
Definition: Logistic.C:26
registerMooseObject("StochasticToolsApp", Logistic)
virtual Real pdf(const Real &x) const override
Definition: Logistic.C:52