I am trying to do mle
for school assignment, why could I be getting this error:
#1) Find best fitting distribution parametersbest_fit(macamil2data) # {'loglaplace': {'c': 1.0603278885766216,# 'loc': -0.04671203840594998,# 'scale': 10.230045114772532}}#2) Calculate pdf using said parametersdef loglaplace_loglikelihood(params, data): c, loc, scale = params return stats.loglaplace.logpdf(data, c=c, loc=loc, scale=scale).sum()#3) Minimize using said parametersinitial_params = [1.0603278885766216, -0.04671203840594998, 10.230045114772532]results = minimize(loglaplace_loglikelihood, initial_params, args=(macamil2data))print(results) message: Desired error not necessarily achieved due to precision loss. success: False status: 2 fun: nan x: [ 5.127e+03 -1.765e+05 -1.945e+03] nit: 2 jac: [ nan nan nan] hess_inv: [[ 6.876e-01 -1.388e+01 5.195e-02] [-1.388e+01 5.437e+02 5.473e+00] [ 5.195e-02 5.473e+00 1.000e+00]] nfev: 464 njev: 116
Tried lowering gtol
, but it appears to me that I am making a systematic error my first time working with data in py. Sorry if it;s silly.
macamil2data=0.91666613.33.383333.683334.166674.26.083336.616677.033337.57.858.159.083339.3510.083310.183310.433311.283314.216.533320.033323.833330.3530.516732.466737.140.816745.65270.066770.533385.2333130.967