Re: Histogram normalization
- To: mathgroup at smc.vnet.net
- Subject: [mg40012] Re: [mg40005] Histogram normalization
- From: Kyriakos Chourdakis <tuxedomoon at yahoo.com>
- Date: Sun, 16 Mar 2003 02:20:18 -0500 (EST)
- Reply-to: k.chourdakis at qmul.ac.uk
- Sender: owner-wri-mathgroup at wolfram.com
The ``smoothed histogram'' you are looking for is
replicated by the nonparametric density. I think you
might find the NonParametricDensity function below
useful. It is a very simplified version without
control over the kernels etc. but it should do the
trick.
The code defines the nonparametric density, creates a
500 point sample from a t_4 distribution, and plots
the ``smooth histogram'' of the sample together with
the t_4.
(***************************************************)
(* Copy into .nb *)
Quit[];
<< "Statistics`ContinuousDistributions`"
NonParametricDensity[x_] := Module[{sx, g, gg, T, h},
sx = StandardDeviation[x]; T = Length[x];
h = (sx*1.06)/T^0.2; g = Function[{u},
(1*Plus @@ (Exp[-((u - #1)^2/(2*h^2))] & ) /@
x)/
(T*h*Sqrt[2*Pi])]; FunctionInterpolation[g[u],
{u, Min[x] - 4*h, Max[x] + 4*h}]];
dist = StudentTDistribution[4];
Y = RandomArray[dist, 500];
NPf = NonParametricDensity[Y];
Plot[{PDF[dist, x], NPf[x]}, {x, -5, 5}, Frame ->
True,
Axes -> False, PlotStyle -> {Thickness[0.],
Thickness[0.01]}];
(***************************************************)
Kyriakos
Kyriakos Chourdakis
http://www.theponytail.net/
__________________________________________________
Do You Yahoo!?
Everything you'll ever need on one web page
from News and Sport to Email and Music Charts
http://uk.my.yahoo.com
- Follow-Ups:
- Re: Re: Histogram normalization
- From: Dr Bob <drbob@bigfoot.com>
- Re: Re: Histogram normalization