One can't use FindDistributionParameters
once the data becomes binned. However, one can construct the log of the likelihood function and then use FindMaximum
as long as you still have the counts. (The relative frequencies won't do.)
(* Generate histogram data with unequal bin widths *)
SeedRandom[12345]
x = RandomVariate[WeibullDistribution[2, 3], 1000];
{borders, counts} = HistogramList[Log[x]];
borders = Exp[borders] // N
(* {0.090718, 0.110803, 0.135335, 0.165299, 0.201897, 0.246597, 0.301194, 0.367879,
0.449329, 0.548812, 0.67032, 0.818731, 1., 1.2214, 1.49182, 1.82212, 2.22554,
2.71828, 3.32012, 4.0552, 4.95303, 6.04965, 7.38906, 9.02501} *)
counts
(* {1, 1, 1, 1, 3, 3, 4, 7, 6, 16, 17, 26, 58, 59, 94, 117, 148, 176, 112, 78, 58, 13, 1} *)
(* Log of the likelihood *)
logL = Sum[counts[[i]] Log[CDF[WeibullDistribution[a, b], borders[[i + 1]]] -
CDF[WeibullDistribution[a, b], borders[[i]]]], {i, Length[counts]}];
(* Find maximum likelihood estimates using the default starting values of 1 for both parameters *)
mle = FindMaximum[{logL, a > 0 && b > 0}, {{a, 1}, {b, 1}}]
(* {-2460.29, {a -> 2.0714, b -> 2.9929}} *)
(* Estimates of standard errors *)
cov = -Inverse[(D[logL, {{a, b}, 2}]) /. mle[[2]]];
ase = cov[[1, 1]]^0.5
(* 0.0516358 *)
bse = cov[[2, 2]]^0.5
(* 0.0485239 *)
FindDistributionParameters
. You'll need to useLogLikelihood
,CDF
, andFindMaximum
and have the counts (rather than relative frequencies). I think there's an example in this forum but using the log normal distribution. I'll look for that. $\endgroup$