Inputs
Index
UncertaintyQuantification.EmpiricalDistribution
UncertaintyQuantification.Interval
UncertaintyQuantification.IntervalVariable
UncertaintyQuantification.JointDistribution
UncertaintyQuantification.Parameter
UncertaintyQuantification.ProbabilityBox
UncertaintyQuantification.RandomVariable
UncertaintyQuantification.GaussianMixtureModel
UncertaintyQuantification.sample
UncertaintyQuantification.sample
Types
UncertaintyQuantification.Parameter Type
Parameter(value::Real, name::Symbol)
Defines a parameter value (scalar), with an input value and a name.
Examples
julia> Parameter(3.14, :π)
Parameter(3.14, :π)
UncertaintyQuantification.Interval Type
Interval(lb::Real, ub::Real)
Represents a closed numeric interval with a lower bound lb
and an upper bound ub
.
Interval
is a data type primarily used for constructing probability boxes (p-boxes) and other uncertainty representations. It is not intended for direct use in simulations for that, see IntervalVariable
.
Fields
lb::Real
: Lower bound of the interval.ub::Real
: Upper bound of the interval.
Examples
julia> Interval(0.10, 0.14)
[0.1, 0.14]
UncertaintyQuantification.ProbabilityBox Type
ProbabilityBox{T}(parameters::Dict{Symbol, Union{Real, Interval}}, lb::Real, ub::Real)
Represents a (optionally truncated) probability box (p-box) for a univariate distribution T
, where parameters may be specified as precise values (Real
) or intervals (Interval
). The support of the distribution is bounded by lb
(lower bound) and ub
(upper bound).
To use the ProbabilityBox
in an analysis it has to be wrapped in a RandomVariable
.
Fields
parameters::Dict{Symbol, Union{Real, Interval}}
: Dictionary mapping parameter names (as symbols) to their values or intervals.lb::Real
: Lower bound of the distribution's support.ub::Real
: Upper bound of the distribution's support.
Constructors
ProbabilityBox{T}(parameters::Dict{Symbol, Union{Real, Interval}}, lb::Real, ub::Real)
: Specify all parameters and support bounds explicitly.ProbabilityBox{T}(parameters::Dict{Symbol, Union{Real, Interval}})
: Support bounds are inferred from the distribution typeT
.ProbabilityBox{T}(parameter::Interval)
: For univariate distributions with a single parameter, construct from a single interval.
For convenience the first two constructors can also be called with a Vector{Pair{Symbol,Union{Real,Interval}}}
to automatically create the Dict
.
Examples
julia> ProbabilityBox{Normal}(Dict(:μ => Interval(0, 1), :σ => Interval(0.1, 1)), 0.0, Inf)
ProbabilityBox{Normal}(Dict{Symbol, Union{Real, Interval}}(:μ => [0, 1], :σ => [0.1, 1]), 0.0, Inf)
julia> ProbabilityBox{Normal}(Dict(:μ => Interval(0, 1), :σ => Interval(0.1, 1)))
ProbabilityBox{Normal}(Dict{Symbol, Union{Real, Interval}}(:μ => [0, 1], :σ => [0.1, 1]), -Inf, Inf)
julia> ProbabilityBox{Exponential}(Interval(0.1, 0.5))
ProbabilityBox{Exponential}(Dict{Symbol, Union{Real, Interval}}(:θ => [0.1, 0.5]), 0.0, Inf)
julia> ProbabilityBox{Normal}([:μ => Interval(0, 1), :σ => Interval(0.1, 1)])
ProbabilityBox{Normal}(Dict{Symbol, Union{Real, Interval}}(:μ => [0, 1], :σ => [0.1, 1]), -Inf, Inf)
UncertaintyQuantification.RandomVariable Type
RandomVariable(dist::UnivariateDistribution, name::Symbol)
Defines a random variable, with a univariate distribution from Distributions.jl and a name.
Examples
julia> RandomVariable(Normal(), :x)
RandomVariable{Normal{Float64}}(Normal{Float64}(μ=0.0, σ=1.0), :x)
julia> RandomVariable(Exponential(1), :x)
RandomVariable{Exponential{Float64}}(Exponential{Float64}(θ=1.0), :x)
UncertaintyQuantification.IntervalVariable Type
IntervalVariable(lb::Real, ub::Real, name::Symbol)
Defines an interval variable with a lower bound lb
, upper bound ub
, and an identifying name
.
IntervalVariable
can be passed directly to analyses and simulations. For other uses, such as building probability boxes (p-boxes) from interval parameters, use Interval
instead.
Fields
lb::Real
: Lower bound of the interval.ub::Real
: Upper bound of the interval.name::Symbol
: Name or identifier for the variable.
Examples
julia> IntervalVariable(0.10, 0.14, :x)
x ∈ [0.1, 0.14]
UncertaintyQuantification.EmpiricalDistribution Type
EmpiricalDistribution(x::Vector{<:Real}, n::Integer=10000)
Creates an empirical distribution from the data given in `x` using kernel density estimation.
The kernel used is Gaussian and the bandwidth is obtained through the Sheather-Jones method.
The support is inferred from the kde using numerical root finding.
The `cdf` and `quantile` functions are linearly interpolated using `n` data points.
UncertaintyQuantification.JointDistribution Type
JointDistribution{D<:Union{Copula,MultivariateDistribution}, M<:Union{RandomVariable,Symbol}}(d, m)
Represents a joint probability distribution, either via a copula and a vector of marginal random variables, or a multivariate distribution and a vector of variable names.
Constructors
JointDistribution(d::Copula, m::Vector{RandomVariable}):
Use a copula
d
to combine the marginal distributions inm
into a joint distribution.The copula's dimension must match the length of
m
.m
must be a vector ofRandomVariable
.
JointDistribution(d::MultivariateDistribution, m::Vector{Symbol}):
Use a multivariate distribution
d
with named components specified bym
.The distribution's dimension (number of variables) must match the length of
m
.m
must be a vector ofSymbol
.
Examples
julia> JointDistribution(GaussianCopula([1.0 0.71; 0.71 1.0]), [RandomVariable(Normal(), :x), RandomVariable(Uniform(), :y)])
JointDistribution{Copula, RandomVariable}(GaussianCopula([1.0 0.71; 0.71 1.0]), RandomVariable[RandomVariable{Normal{Float64}}(Normal{Float64}(μ=0.0, σ=1.0), :x), RandomVariable{Uniform{Float64}}(Uniform{Float64}(a=0.0, b=1.0), :y)])
julia> JointDistribution(MultivariateNormal([1.0 0.71; 0.71 1.0]), [:x, :y])
JointDistribution{MultivariateDistribution, Symbol}(ZeroMeanFullNormal(
dim: 2
μ: Zeros(2)
Σ: [1.0 0.71; 0.71 1.0]
)
, [:x, :y])
Functions
UncertaintyQuantification.sample Function
sample(rv::RandomVariable, n::Integer=1)
Generates n samples from a random variable. Returns a DataFrame.
Examples
See also: RandomVariable
UncertaintyQuantification.sample Function
sample(inputs::Vector{<:UQInput}, n::Integer=1)
Generates n correlated samples from a collection of inputs. Returns a DataFrame
See also: RandomVariable
, Parameter
UncertaintyQuantification.GaussianMixtureModel Function
GaussianMixtureModel(
data::DataFrame,
number_components::Integer;
maximum_iterations::Integer=100,
tolerance::Number=1e-4,
)
Fits a Gaussian mixture model to the given data using the Expectation-Maximization (EM) algorithm.
Arguments
data::DataFrame
: The input data as a DataFrame, where each column represents a variable.number_components::Integer
: The number of Gaussian components to fit.maximum_iterations::Integer=100
: (Optional) The maximum number of EM iterations. Default is 100.tolerance::Number=1e-4
: (Optional) The convergence tolerance for the EM algorithm. Default is 1e-4.
Returns
JointDistribution
: A joint distribution object representing the fitted Gaussian mixture model, with variable names corresponding to the columns ofdata
.
See also: JointDistribution