Source code for naginterfaces.library.examples.univar.estim_weibull_ex
#!/usr/bin/env python3
"``naginterface.library.univar.estim_weibull`` Python Example."
# NAG Copyright 2017-2019.
# pylint: disable=invalid-name
from naginterfaces.library import univar
[docs]def main():
"""
Example for :func:`naginterfaces.library.univar.estim_weibull`.
Maximum likelihood estimates for parameters of the Weibull distribution.
>>> main()
naginterfaces.library.univar.estim_weibull Python Example Results.
Maximum likelihood estimates for parameters of the Weibull distribution.
beta^ = -2.1073, standard error = 0.4627
gamma^ = 2.7870, standard error = 0.4273
"""
print('naginterfaces.library.univar.estim_weibull Python Example Results.')
print(
'Maximum likelihood estimates for parameters of the '
'Weibull distribution.'
)
# Non-censored data:
cens = 'Noncensored'
# The observations:
x = [
1.1, 1.4, 1.3, 1.7, 1.9,
1.8, 1.6, 2.2, 1.7, 2.7,
4.1, 1.8, 1.5, 1.2, 1.4,
3.0, 1.7, 2.3, 1.6, 2.0,
]
# No censoring codes:
ic = [0]
# Compute gamma internally:
gamma = 0.
# Use default tolerance and iterations limit:
tol = 0.
maxit = 0
weib = univar.estim_weibull(
cens, x, ic, gamma, tol, maxit,
)
print(
'beta^ = {:10.4f}, standard error = {:10.4f}'.format(
weib.beta, weib.sebeta,
)
)
print(
'gamma^ = {:10.4f}, standard error = {:10.4f}'.format(
weib.gamma, weib.segam,
)
)
if __name__ == '__main__':
import doctest
import sys
sys.exit(
doctest.testmod(
None, verbose=True, report=False,
optionflags=doctest.REPORT_NDIFF,
).failed
)