File size: 2,477 Bytes
5ab75a9
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
function [phat,pci] = ConjDist_binofit(x,n)
% ConjDist_binofit - Call binofit, but catch the special case of n=0.
%
% Syntax: [phat,pci] = ConjDist_binofit(x,n)
%
% =========================================================================
%
% Copyright (c) 2025 United States Government as represented by the
% Administrator of the National Aeronautics and Space Administration.
% All Rights Reserved.
%
% =========================================================================
%
% Description: Call binofit, but catch the special case of n=0.
%
% =========================================================================
%
% Input:
%
%   x      - Number of successes                                      [Nx1]
%
%   n      - Number of trials. The i-th entry of n must be greater    [Nx1]
%            than or equal to the i-th entry of x                     
% =========================================================================
%
% Output:
%
%   phat   - MLE of the progability of success for a binomial         [Nx1] 
%            distribution with x successes over n trials
%
%   pci    - 95% confidence interval lower/upper bounds               [Nx2] 
%            corresponding to each estimate phat
%
% =========================================================================
%
% Dependencies:
%
%   None
%
%
% =========================================================================
%
% Subfunctions:
%
%   None
%
% =========================================================================
%
% Initial version: Apr 2022;  Latest update: Apr 2022
%
% ----------------- BEGIN CODE -----------------
if (n > 0)
    [phat,pci] = binofit(x,n);
elseif (n == 0)
    phat = 0; pci = [0 0];
else
    phat = NaN; pci = [NaN NaN];
end

return;
end 
% ----------------- END OF CODE ------------------
%
% Please record any changes to the software in the change history
% shown below:
%
% ----------------- CHANGE HISTORY ------------------
% Developer |     Date    | Description
% ---------------------------------------------------
% D. Hall   | 2022-Apr-11 | Initial version.
% =========================================================================
%
% Copyright (c) 2025 United States Government as represented by the
% Administrator of the National Aeronautics and Space Administration.
% All Rights Reserved.
%
% =========================================================================