I have some data
(1593 values). I first binned it using the Knuth rule and fitted a function that is a linear combination of two sinh-arcsinh functions. I then rounded the resulting parameters to perform a FindDistributionParameters
search of parameters using "MaximumLikelihood"
as a ParameterEstimator
. The problem is that after a lengthy computation I get an error message:
FindMaximum::eit: "The algorithm does not converge to the tolerance of 4.806217383937354`*^-6 in 100 iterations. The best estimated solution, with feasibility residual, KKT residual, or complementary residual of {8.33678,100.,4.16864}, is returned.
Unfortunately, there's no such thing like MaxIterations->Infinity
in FindDistributionParameters
.
The suitable code below; file.txt available here
import = Import["file.txt", "Table"];
data = Flatten[import];
data = Log[10, data];
data = Delete[data, Position[data, RankedMin[data, 1]][[1, 1]]];
data = Delete[data, Position[data, RankedMin[data, 1]][[1, 1]]];
data = Delete[data, Position[data, RankedMax[data, 1]][[1, 1]]];
sas[μ_, σ_, skew_, kurt_] :=
ProbabilityDistribution[((1 + ((z - μ)/σ)^2)^(-(1/2))
kurt Cosh[
kurt ArcSinh[(z - μ)/σ] -
skew] Exp[-(1/2) Sinh[
kurt ArcSinh[(z - μ)/σ] - skew]^2])/(
Sqrt[2 π] σ), {z, -Infinity, Infinity}]
dist = MixtureDistribution[{p,
1 - p}, {sas[μ1, σ1, skew1, kurt1],
sas[μ2, σ2, skew2, kurt2]}]
param = FindDistributionParameters[data,
dist, {{μ1, -0.2}, {σ1, 0.7}, {skew1, 0.3}, {kurt1,
1.}, {μ2, 1.5}, {σ2, 0.5}, {skew2, 0.}, {kurt2,
1.}, {p, 0.25}},
ParameterEstimator -> {"MaximumLikelihood",
Method -> "NMaximize"}]
I'm not sure whether the error may be ignored, or it implies that there is room for a significant improvement of the obtained result. If the error may be dealt with, what's the solution?
PDF[sas[0.1, 1, 0.3, 0.4], 10]
and you'll see there's a symbolic\[Sigma]1
lurking there. If we change the... Sqrt[2 \[Pi]] \[Sigma]1) ...
toSqrt[2 \[Pi]] \[Sigma])
we can now get values out and do stuff likePlot[PDF[sas[0.1, 1, 0.3, 0.4], x], {z, -10, 10}]
. I can't help with the rest of the problem if I don't have some values fordata
. $\endgroup$0 <= p <= 1
in the assumptions and since we're restricting it to a two-mixture p and 1-p are surely adequate weights. We can't make any assumptions on the dependency or use the Bayes' rule because we don't have the original classes the data came from. $\endgroup$