|
|
@ -192,7 +192,6 @@ class Profile(object):
|
|
|
|
Examples
|
|
|
|
Examples
|
|
|
|
--------
|
|
|
|
--------
|
|
|
|
# MLE
|
|
|
|
# MLE
|
|
|
|
>>> import numpy as np
|
|
|
|
|
|
|
|
>>> import wafo.stats as ws
|
|
|
|
>>> import wafo.stats as ws
|
|
|
|
>>> R = ws.weibull_min.rvs(1,size=100);
|
|
|
|
>>> R = ws.weibull_min.rvs(1,size=100);
|
|
|
|
>>> phat = FitDistribution(ws.weibull_min, R, 1, scale=1, floc=0.0)
|
|
|
|
>>> phat = FitDistribution(ws.weibull_min, R, 1, scale=1, floc=0.0)
|
|
|
@ -364,6 +363,10 @@ class Profile(object):
|
|
|
|
pcov = self.fit_dist.par_cov[i_notfixed, :][:, i_notfixed]
|
|
|
|
pcov = self.fit_dist.par_cov[i_notfixed, :][:, i_notfixed]
|
|
|
|
pvar = sum(numpy.dot(drl, pcov) * drl)
|
|
|
|
pvar = sum(numpy.dot(drl, pcov) * drl)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if pvar<0:
|
|
|
|
|
|
|
|
pvar = -pvar*2
|
|
|
|
|
|
|
|
elif numpy.isnan(pvar):
|
|
|
|
|
|
|
|
pvar = p_opt*0.5
|
|
|
|
p_crit = -norm_ppf(self.alpha / 2.0) * sqrt(numpy.ravel(pvar)) * 1.5
|
|
|
|
p_crit = -norm_ppf(self.alpha / 2.0) * sqrt(numpy.ravel(pvar)) * 1.5
|
|
|
|
if self.pmin == None:
|
|
|
|
if self.pmin == None:
|
|
|
|
self.pmin = p_opt - 5.0 * p_crit
|
|
|
|
self.pmin = p_opt - 5.0 * p_crit
|
|
|
@ -515,7 +518,6 @@ class FitDistribution(rv_frozen):
|
|
|
|
--------
|
|
|
|
--------
|
|
|
|
Estimate distribution parameters for weibull_min distribution.
|
|
|
|
Estimate distribution parameters for weibull_min distribution.
|
|
|
|
>>> import wafo.stats as ws
|
|
|
|
>>> import wafo.stats as ws
|
|
|
|
>>> import numpy as np
|
|
|
|
|
|
|
|
>>> R = ws.weibull_min.rvs(1,size=100);
|
|
|
|
>>> R = ws.weibull_min.rvs(1,size=100);
|
|
|
|
>>> phat = FitDistribution(ws.weibull_min, R, 1, scale=1, floc=0.0)
|
|
|
|
>>> phat = FitDistribution(ws.weibull_min, R, 1, scale=1, floc=0.0)
|
|
|
|
|
|
|
|
|
|
|
@ -719,7 +721,8 @@ class FitDistribution(rv_frozen):
|
|
|
|
'''Compute covariance
|
|
|
|
'''Compute covariance
|
|
|
|
'''
|
|
|
|
'''
|
|
|
|
somefixed = (self.par_fix != None) and any(isfinite(self.par_fix))
|
|
|
|
somefixed = (self.par_fix != None) and any(isfinite(self.par_fix))
|
|
|
|
H = numpy.asmatrix(self.dist.hessian_nnlf(self.par, self.data))
|
|
|
|
H1 = numpy.asmatrix(self.dist.hessian_nnlf(self.par, self.data))
|
|
|
|
|
|
|
|
H = numpy.asmatrix(self.dist.hessian_nlogps(self.par, self.data))
|
|
|
|
self.H = H
|
|
|
|
self.H = H
|
|
|
|
try:
|
|
|
|
try:
|
|
|
|
if somefixed:
|
|
|
|
if somefixed:
|
|
|
@ -798,7 +801,6 @@ class FitDistribution(rv_frozen):
|
|
|
|
Examples
|
|
|
|
Examples
|
|
|
|
--------
|
|
|
|
--------
|
|
|
|
# MLE
|
|
|
|
# MLE
|
|
|
|
>>> import numpy as np
|
|
|
|
|
|
|
|
>>> import wafo.stats as ws
|
|
|
|
>>> import wafo.stats as ws
|
|
|
|
>>> R = ws.weibull_min.rvs(1,size=100);
|
|
|
|
>>> R = ws.weibull_min.rvs(1,size=100);
|
|
|
|
>>> phat = FitDistribution(ws.weibull_min, R, 1, scale=1, floc=0.0)
|
|
|
|
>>> phat = FitDistribution(ws.weibull_min, R, 1, scale=1, floc=0.0)
|
|
|
@ -1006,13 +1008,15 @@ class FitDistribution(rv_frozen):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def main():
|
|
|
|
def main():
|
|
|
|
|
|
|
|
import doctest
|
|
|
|
|
|
|
|
doctest.testmod()
|
|
|
|
|
|
|
|
def test1():
|
|
|
|
|
|
|
|
import wafo.stats as ws
|
|
|
|
|
|
|
|
R = ws.weibull_min.rvs(1,size=100);
|
|
|
|
|
|
|
|
phat = FitDistribution(ws.weibull_min, R, method='mps')
|
|
|
|
|
|
|
|
|
|
|
|
# import wafo.stats as ws
|
|
|
|
|
|
|
|
# R = ws.weibull_min.rvs(1,size=100);
|
|
|
|
|
|
|
|
# phat = FitDistribution(ws.weibull_min, R, 1, scale=1, floc=0.0)
|
|
|
|
|
|
|
|
#
|
|
|
|
|
|
|
|
# # Better CI for phat.par[i=0]
|
|
|
|
# # Better CI for phat.par[i=0]
|
|
|
|
# Lp1 = Profile(phat, i=0)
|
|
|
|
Lp1 = Profile(phat, i=1)
|
|
|
|
# Lp2 = Profile(phat, i=2)
|
|
|
|
# Lp2 = Profile(phat, i=2)
|
|
|
|
# SF = 1./990
|
|
|
|
# SF = 1./990
|
|
|
|
# x = phat.isf(SF)
|
|
|
|
# x = phat.isf(SF)
|
|
|
@ -1029,8 +1033,7 @@ def main():
|
|
|
|
# pass
|
|
|
|
# pass
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import doctest
|
|
|
|
|
|
|
|
doctest.testmod()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# _WAFODIST = ppimport('wafo.stats.distributions')
|
|
|
|
# _WAFODIST = ppimport('wafo.stats.distributions')
|
|
|
@ -1080,4 +1083,5 @@ def main():
|
|
|
|
# lp = pht.profile()
|
|
|
|
# lp = pht.profile()
|
|
|
|
|
|
|
|
|
|
|
|
if __name__ == '__main__':
|
|
|
|
if __name__ == '__main__':
|
|
|
|
|
|
|
|
test1()
|
|
|
|
main()
|
|
|
|
main()
|
|
|
|