Skip to content

Commit 8880b91

Browse files
committed
Minor updates
1 parent e9ed971 commit 8880b91

2 files changed

Lines changed: 7 additions & 8 deletions

File tree

src/psisloo.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ not exist and if tail index k>1 the mean of the raw estimate does not exist
2020
and the PSIS estimate is likely to have large variation and some bias.
2121
2222
# Arguments
23-
* `log_lik::Union{AbstractArray, Mamba.Chains}`: Array of size n x m containing n posterior samples of the log likelihood terms p(y_i|\theta^s).
23+
* `log_lik::AbstractArray`: Array of size n x m containing n posterior samples of the log likelihood terms p(y_i|\theta^s).
2424
* `wcpp::Real`: Percentage of samples used for GPD fit estimate (default is 20).
2525
* `wtrunc::Float64`: Positive parameter for truncating very large weights to n^wtrunc. Providing False or 0 disables truncation. Default values is 3/4.
2626

src/waic.jl

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,21 +4,20 @@ var2(x) = mean(x.^2) .- mean(x)^2
44
function waic( ll::AbstractArray; pointwise=false , log_lik="log_lik" , kwargs... )
55

66
n_samples, n_obs = size(ll)
7-
#lpd = zeros(n_obs)
8-
pD = zeros(n_obs)
7+
pD = zeros(n_obs);
98

10-
lpd = reshape(logsumexp(ll .- log(n_samples); dims=1), n_obs)
9+
lpd = reshape(logsumexp(ll .- log(n_samples); dims=1), n_obs);
1110
for i in 1:n_obs
1211
pD[i] = var2(ll[:,i])
1312
end
1413

15-
waic_vec = (-2) .* ( lpd - pD )
14+
waic_vec = (-2) .* ( lpd - pD );
1615
if pointwise == false
17-
waic = sum(waic_vec)
16+
waics = sum(waic_vec)
1817
lpd = sum(lpd)
1918
pD = sum(pD)
2019
else
21-
waic = waic_vec
20+
waics = waic_vec
2221
end
2322

2423
local se
@@ -29,7 +28,7 @@ function waic( ll::AbstractArray; pointwise=false , log_lik="log_lik" , kwargs..
2928
se = nothing
3029
end
3130

32-
(WAIC=waic, lppd=lpd, penalty=pD, std_err=se)
31+
(WAIC=waics, lppd=lpd, penalty=pD, std_err=se)
3332
end
3433

3534
export

0 commit comments

Comments
 (0)