Skip to content

Commit

Permalink
Update distributions.jl
Browse files Browse the repository at this point in the history
  • Loading branch information
alexpkeil1 committed Sep 19, 2023
1 parent d2c2a41 commit 4014a86
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions src/distributions.jl
Original file line number Diff line number Diff line change
Expand Up @@ -205,28 +205,25 @@ function Lognormal()
Lognormal(ones(Float64, 2)...)
end

# Methods for Weibull
# Methods for Lognormal
"""
d = Distr
t = m.R.exit[i]
"""
function lpdf(d::Lognormal, t)
# parameterization of Lee and Wang (SAS)
#log(d.ρ) + log(d.γ) + t*(d.γ - 1.0) * log(d.ρ) - (d.ρ * t^d.γ)
# location scale representation (Klein Moeschberger ch 12)
# Lik: 1/sigma * exp((logt - mu)/sigma - exp((logt-mu)/sigma))
# lLik: log(1/sigma) + (logt - mu)/sigma - exp((logt-mu)/sigma)
inv(sqrt(2pi))


z = (log(t) - d.ρ) / d.γ
ret = -log(d.γ) + z - exp(z)
#ret -= log(t) # change in variables, log transformation on t
ret
end

function lsurv(d::Lognormal, t)
# parameterization of Lee and Wang (SAS)
#-(d.ρ * t^d.γ)
# location scale representation (Klein Moeschberger ch 12, modified from Wikipedia page on Gumbel Distribution)
# location scale representation (Klein Moeschberger ch 12, modified from Wikipedia page
z = (log(t) - d.ρ) / d.γ
ret = -exp(z)
#ret -= log(t) # change in variables, log transformation on t
Expand Down

0 comments on commit 4014a86

Please sign in to comment.