Новое в системе Wolfram
Mathematica
8: Оценивание параметров распределений и проверка статистических гипотез
◄
предыдущая
|
следующая
►
Основные алгоритмы
Оценивание параметров распределения методом наибольшего правдоподобия и методом моментов
Оценивание параметров распределения Хотеллинга
с параметрами
p
и
m
с помощью метода наибольшего правдоподобия, и метода моментов.
In[1]:=
X
data = BlockRandom[SeedRandom[1234]; RandomVariate[HotellingTSquareDistribution[15, 20], 250]]; hist = Histogram[data, 50, "PDF", ImageSize -> 250, ChartStyle -> Directive[Opacity[.2], Hue[.742, .7, .7]]]; momentgrid = Grid[{{"Method of Moments"}, {"\!\(\*SubscriptBox[\(\[Mu]\), \(1\)]\ \)(data) = \!\(\*SubscriptBox[\(\[Mu]\), \(1\)]\)(dist) = " <> ToString[ Round[Mean[ data], .01]]}, {"\!\(\*SubscriptBox[\(\[Mu]\), \ \(2\)]\)(data) = \!\(\*SubscriptBox[\(\[Mu]\), \(2\)]\)(dist) = " <> ToString[Round[Moment[data, 2], .01]]}}, Frame -> True, Spacings -> {3, 2}]; mldist = EstimatedDistribution[data, HotellingTSquareDistribution[p, m]]; mmdist = EstimatedDistribution[data, HotellingTSquareDistribution[p, m], ParameterEstimator -> "MethodOfMoments"]; mlgrid = Grid[{{"Maximum Likelihood"}, \ {"argmax(\[ScriptL](dist,data)) = ", MatrixForm[Round[Apply[List, mldist], .1]]}}, Frame -> True, Spacings -> {0, 2}]; mlpdfplot = Show[hist, Plot[PDF[mldist, x], {x, 0, 300}, Filling -> Axis, ImageSize -> 250, PlotStyle -> {Hue[.742, .7, .7], Thick}], Epilog -> Style[Text[ "p = " <> ToString[Round[mldist[[1]], .1]] <> "\nm = " <> ToString[Round[mldist[[2]], .1]], {300, .01}], FontFamily -> "Verdana"]]; mmpdfplot = Show[hist, Plot[PDF[mmdist, x], {x, 0, 300}, Filling -> Axis, ImageSize -> 250, PlotStyle -> {Hue[.742, .7, .7], Thick}], Epilog -> Style[Text[ "p = " <> ToString[Round[mmdist[[1]], .1]] <> "\nm = " <> ToString[Round[mmdist[[2]], .1]], {300, .01}], FontFamily -> "Verdana"]]; arrow = Graphics[{Thick, {Arrowheads[Large], Arrow[{{0, 0}, {1, 0}}, .2]}}]; Column[{Show[hist, PlotLabel -> Style["Data", FontFamily -> "Verdana"]], Style[Grid[{{mlgrid, arrow, mlpdfplot}, {momentgrid, arrow, mmpdfplot}}, Spacings -> 0], FontFamily -> "Verdana"]}, Alignment -> Center]
Out[1]=