Commit 50ca87fc authored by Stéphane Adjemian's avatar Stéphane Adjemian

Added normcdf function in Utils module.

Cannot use normcdf from StatsFuns because the ordering of the inputs
are different.
parent fb4f93ba
julia 0.6- julia 1.0-
Calculus Calculus
NLsolve NLsolve
Suppressor Suppressor
BinaryProvider BinaryProvider
SpecialFunctions
\ No newline at end of file
module Utils module Utils
## ##
# Copyright (C) 2015 Dynare Team # Copyright © 2015-2019 Dynare Team
# #
# This file is part of Dynare. # This file is part of Dynare.
# #
...@@ -18,6 +18,10 @@ module Utils ...@@ -18,6 +18,10 @@ module Utils
# along with Dynare. If not, see <http://www.gnu.org/licenses/>. # along with Dynare. If not, see <http://www.gnu.org/licenses/>.
## ##
import Base: @irrational
@irrational sqrt2 1.4142135623730950488 sqrt(big(2.0))
@irrational invsqrt2 0.7071067811865475244 inv(big(sqrt2))
export get_power_deriv export get_power_deriv
function get_power_deriv(x::Float64, p::Real, k::Int) function get_power_deriv(x::Float64, p::Real, k::Int)
...@@ -33,4 +37,16 @@ function get_power_deriv(x::Float64, p::Real, k::Int) ...@@ -33,4 +37,16 @@ function get_power_deriv(x::Float64, p::Real, k::Int)
return dxp return dxp
end end
using SpecialFunctions
export normcdf
normcdf(z::Number) = erfc(-z * invsqrt2)/2
function normcdf(x::Number, μ::Real, σ::Real)
z = (x - μ) / σ
normcdf(z)
end
end end
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment