Re: Superimposing Normal on a Histogram of data
- To: mathgroup at smc.vnet.net
- Subject: [mg91585] Re: Superimposing Normal on a Histogram of data
- From: axel <axel.kilian at hs-merseburg.de>
- Date: Thu, 28 Aug 2008 03:17:53 -0400 (EDT)
- References: <g93b4p$kol$1@smc.vnet.net>
On 27 Aug., 12:43, ouadad <desmier... at forces.gc.ca> wrote: > Can someone point me to an algorithm that allows me to plot a normal curv= e over a histogram of residuals? I just want to show how close my residu= al distribution approximates a normal distribution. Here is the code: Needs["Histograms`"]; data = Table[Sum[Random[], {300}], {300}]; \[Mu] = Mean[data]; \[Sigma] = StandardDeviation[data]; distfunc = PDF[NormalDistribution[\[Mu], \[Sigma]], x]; histCategories = 15; histogramGraphics = Histogram[data, HistogramCategories -> histCategories]; {xmin, xmax} = {Min[data], Max[data]}; distfuncGraphics = Plot[distfunc*Length[data]*(xmax - xmin)/(histCat + 1), {x, xmin, xmax}, PlotStyle -> Red]; Show[{histogramGraphics, distfuncGraphics}, PlotRange -> All]