Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.soft-sys.math.mathematica > #9882

Re: histospline

From Bob Hanlon <hanlonr357@gmail.com>
Newsgroups comp.soft-sys.math.mathematica
Subject Re: histospline
Date 2012-04-30 08:42 +0000
Organization Steven M. Christensen and Associates, Inc and MathTensor, Inc.
Message-ID <jnlja2$n42$1@smc.vnet.net> (permalink)
References <201204290611.CAA10877@smc.vnet.net>

Show all headers | View raw


Not sure if this is what you want but it may help.

Clear[compare]

compare::usage =
  "compare[data, dist] plots PDF of maximum likelihood estimate with \
histogram scaled as PDF.";

compare[data_,
   dist_: NormalDistribution[Unique[], Unique[]]] :=
  Module[
   {estDist =
     EstimatedDistribution[data, dist]},
   Show[
    Histogram[data, Automatic, "PDF",
     ChartStyle -> EdgeForm[None]],
    Plot[PDF[estDist, x],
     {x, Min[data], Max[data]},
     PlotStyle -> Darker[Red]],
    Frame -> True,
    Axes -> False,
    PlotLabel -> "Data Histogram and " <> ToString[estDist]]];

dist1 = NormalDistribution[5*RandomReal[], 2*RandomReal[]]

data1 = RandomVariate[dist1, 200];

compare[data1] (* defaults to NormalDistribution *)

dist2 = GammaDistribution[4*RandomReal[] + 1, 2*RandomReal[]]

data2 = RandomVariate[dist2, 300];

compare[data2, GammaDistribution[a, b]]


Bob Hanlon


On Sun, Apr 29, 2012 at 2:11 AM, paul <paulvonhippel@yahoo.com> wrote:
> I'm looking for a Mathematica package that can generate a histospline.
> This is a smooth density estimate based only on the information in a histogram.
>

Back to comp.soft-sys.math.mathematica | Previous | Next | Find similar | Unroll thread


Thread

Re: histospline Bob Hanlon <hanlonr357@gmail.com> - 2012-04-30 08:42 +0000

csiph-web