EBCIC: Exact Binomial Confidence Interval Calculator
MATLAB R2021a (64-bit (win64))
Python 3.8.10 (Windows installer (64-bit))
ebcic 0.0.1
Widows 10 (64-bit 20H2)
XX
-bit) from the official page:
XX
shall be the same as that of MATLAB, which can be checked by any of the followings:
computer
or mexext
on a MATLAB command prompt.ebcic
package to the installed PythonCheck the absolute path to the install python.exe on a windows terminal, such as PowerShell and Command Prompt:
where python.exe
Install ebcic
package with:
<the_full_path_to_python>\python.exe -m pip install ebcic
where <the_full_path_to_python>
is like C:\Users\<your_account_name>\AppData\Local\Programs\Python\Python38
and <your_account_name>
is your login name to Windows.
Set the python version to use on MATLAB according to MathWorks’ page.
pe=pyenv("Version", '3.8')
If Python other than ‘Windows installer’ is installed, tell MATLAB the full path (absolute path) to the installed python.exe with:
pyenv("Version", "<the_full_path_to_python>\python.exe")
Even with this pyenv()
command, Python (3.8.10 at least) from Microsoft Store could not be used from MATLAB.
If the following returns blank or ans = ""
, the installed Python is not usable from MATLAB, and try another Python installation.
pe.Version
pe.Executable
confidence_interval=cell(py.ebcic.exact(py.ebcic.Params(pyargs( ...
'k',1, ...% # of errors
'n',100, ...% # of trials
'confi_perc',confi_perc ...% Confidence percentage:
...% for two-sided of 0<k<n where 0 < confi_perc < 100, or
...% for one-sided of k=0 or k=n.
...% NOTE
...% For one-sided of 0<k<n,
...% set confi_perc=(2 * confi_perc_for_one_sided - 100)
...% where 50 < confi_perc_for_one_sided < 100.
))));
% As variables.
lower_interval=confidence_interval{1,1}
upper_interval=confidence_interval{1,2}
Result:
lower_interval = 5.0124e-05
upper_interval = 0.0720
To depict graphs in this page, edit the parameters below. The following example corresponds with “Exact intervals and the line of k/n for k=1” where members of the ‘confi_perc_list’ are reduced (due to the following bug on ‘the legend outside of the graph area’.).
py.ebcic.interval_graph(py.ebcic.GraProps(pyargs( ...
...% Set the range of k to depict with k_*
'k_start',int32(1), ...
'k_end', int32(1), ...
...% Edit the list of confidence percentages to depict, [confi_perc, ...],
...% for two-sided of 0<k<n where 0 < confi_perc < 100, or
...% for one-sided of k=0 or k=n.
...% NOTE For one-sided of 0<k<n, set
...% confi_perc=(2 * confi_perc_for_one_sided - 100)
...% where 50 < confi_perc_for_one_sided < 100
...% (though both lower and upper intervals are shown).
'confi_perc_list',[95.0, 99.0], ...
...% Add or remove lines to depict.
'line_list',[ ...
'with_line_kn', ...% Line of k/n
'with_exact', ...% Exact interval
...% 'with_wilson_cc', ...% Wilson score interval with continuity correction
...% 'with_wilson', ...% Wilson score interval; not available for k=0
...% 'with_normal', ...% Normal approximation interval; not available for k=0
...% 'with_rule_of_la',...% Rule of -ln(alpha); available only for k=0
] ...
)))