Skip to content

Commit

Permalink
bootbayes now supports NaN value for PROB input argument
Browse files Browse the repository at this point in the history
  • Loading branch information
acp29 committed Jun 16, 2024
1 parent 6970bb2 commit 2ec0144
Showing 1 changed file with 14 additions and 11 deletions.
25 changes: 14 additions & 11 deletions inst/bootbayes.m
Original file line number Diff line number Diff line change
Expand Up @@ -386,17 +386,20 @@
bias = mean (bootstat, 2) - original;

% Compute credible intervals
if (prior > 0)
ci = credint (bootstat, prob);
else
stdnorminv = @(p) sqrt (2) * erfinv (2 * p - 1);
switch nprob
case 1
z = stdnorminv (1 - (1 - prob) / 2);
ci = original + std (bootstat, 1 , 2) * z * [-1, 1];
case 2
z = stdnorminv (prob);
ci = original + std (bootstat, 1 , 2) * z;
ci = nan (p, 2);
if (any (~ isnan (prob)))
if (prior > 0)
ci = credint (bootstat, prob);
else
stdnorminv = @(p) sqrt (2) * erfinv (2 * p - 1);
switch nprob
case 1
z = stdnorminv (1 - (1 - prob) / 2);
ci = original + std (bootstat, 1 , 2) * z * [-1, 1];
case 2
z = stdnorminv (prob);
ci = original + std (bootstat, 1 , 2) * z;
end
end
end

Expand Down

0 comments on commit 2ec0144

Please sign in to comment.