https://mooseframework.inl.gov
Loading...
Searching...
No Matches
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
14registerMooseObject("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
31Real
32Logistic::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
38Real
39Logistic::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
45Real
46Logistic::quantile(const Real & p, const Real & location, const Real & shape)
47{
48 return location - shape * std::log(1.0 / p - 1.0);
49}
50
51Real
52Logistic::pdf(const Real & x) const
53{
54 return pdf(x, _location, _shape);
55}
56
57Real
58Logistic::cdf(const Real & x) const
59{
60 return cdf(x, _location, _shape);
61}
62
63Real
64Logistic::quantile(const Real & p) const
65{
66 return quantile(p, _location, _shape);
67}
const std::vector< double > x
const Real p
registerMooseObject("StochasticToolsApp", Logistic)
static InputParameters validParams()
void addRequiredParam(const std::string &name, const std::string &doc_string)
void addClassDescription(const std::string &doc_string)
A class used to generate a logistic distribution.
Definition Logistic.h:18
static InputParameters validParams()
Definition Logistic.C:17
virtual Real pdf(const Real &x) const override
Definition Logistic.C:52
const Real & _location
The location or mean of the distribution (alpha or mu)
Definition Logistic.h:34
virtual Real quantile(const Real &p) const override
Definition Logistic.C:64
Logistic(const InputParameters &parameters)
Definition Logistic.C:26
const Real & _shape
The shape of the distribution (beta or s)
Definition Logistic.h:37
virtual Real cdf(const Real &x) const override
Definition Logistic.C:58