# Decomponha modelos de mistura das magnitudes de terremotos

Plote os componentes de um modelo de mistura para valores históricos de magnitudes de terremotos versus dados e visualize a probabilidade de que uma magnitude específica venha de cada componente do modelo.
 In[1]:= Xmagnitudes = Select[ExampleData[{"Statistics", "USEarthquakes"}], #[[1]] >= 1935 &][[All, 7]];
 In[2]:= Xedist = EstimatedDistribution[magnitudes, MixtureDistribution[{p, 1 - p}, {NormalDistribution[a, b], NormalDistribution[c, d]}]];
 In[3]:= Xwts = Table[edist[[1, i]] PDF[edist[[2, i]], x], {i, 2}]; h = Histogram[magnitudes, 20, "ProbabilityDensity", ChartStyle -> Directive[Opacity[.6], Hue[.242, .4, .8]]]; GraphicsRow[{Show[h, Plot[wts, {x, 2, 8}, PlotStyle -> {{Hue[.01, .6, .6], Thick}, {Hue[.6, .7, .7], Thick}}, PlotRange -> All], PlotLabel -> Style["PDF Components", FontFamily -> "Verdana"]], Plot[Evaluate[ Table[edist[[1, i]] PDF[edist[[2, i]], x]/Total[wts], {i, 2}]], {x, 3, 7}, PlotStyle -> {{Hue[.01, .6, .6], Thick}, {Hue[.6, .7, .7], Thick}}, FillingStyle -> {1 -> Directive[Opacity[.3], Hue[.01, .6, .6]], 2 -> Directive[Opacity[.3], Hue[.6, .7, .7]]}, PlotRange -> All, Filling -> Axis, PlotLabel -> Style["Component Probabilities", FontFamily -> "Verdana"]]}]
 Out[3]=