Re: Fitting NormalDistribution to 2D List
- To: mathgroup at smc.vnet.net
 - Subject: [mg31459] Re: Fitting NormalDistribution to 2D List
 - From: post_12 at hotmail.com (postman)
 - Date: Wed, 7 Nov 2001 05:29:30 -0500 (EST)
 - References: <9s1uhd$o4b$1@smc.vnet.net>
 - Sender: owner-wri-mathgroup at wolfram.com
 
BobHanlon at aol.com wrote in message news:<9s1uhd$o4b$1 at smc.vnet.net>...
> Needs["Statistics`NormalDistribution`"];
> Needs["Statistics`DescriptiveStatistics`"];
Bob:
This was very helpful, thanks for taking the time to post. I still
haven't got my head around the use of symbols like # and & in
Mathematica, but I will use your examples to learn more about them
While the code you posted solves the specific example I asked about, I
am still unable to fit my data to an arbitrary distribution (e.g.
ExtremeValue, LaPlace). Is there a way to pass these distributions and
my Tables of data to the Nonlinear fitting algorithm? Unrolling is
unfortunately not an option; my machine (1GB RAM) ran out of memory
trying to unroll 1 data set.
Thanks again for your help -
> 
> data={{1,2},{2,8},{3,16},{4,7},{5,3}};
> 
> unrolledData = Flatten[Table[#[[1]],{#[[2]]}]& /@data];
> 
> mu = Mean[unrolledData];
> 
> To find the mean without unrolling
> 
> mu==(Plus@@(Times@@#& /@ data))/(Plus@@data[[All,2]])
> 
> True
> 
> or
> 
> mu==Tr[Times@@#& /@ data]/Tr[data[[All,2]]]
> 
> True
> 
> or
> 
> mu==(Dot@@Transpose[data])/Tr[data[[All,2]]]
> 
> True
> 
> Selecting a method
> 
> binnedMean[data_] := Tr[Times@@#& /@ data]/Tr[data[[All,2]]];
> 
> m = binnedMean[data];
> 
> The StandardDeviationMLE of the data without "unrolling" is
> 
> s = Sqrt[binnedMean[{(#[[1]]-m)^2, #[[2]]}& /@ data]];
> 
> s == StandardDeviationMLE[unrolledData]
> 
> True
> 
> The distribution is
> 
> NormalDistribution[m, s]
> 
> NormalDistribution[109/36, 
>   Sqrt[1259]/36]
> 
> 
> Bob Hanlon
> Chantilly, VA  USA
- Follow-Ups:
- Re: Re: Fitting NormalDistribution to 2D List
- From: Daniel Lichtblau <danl@wolfram.com>
 
 
 - Re: Re: Fitting NormalDistribution to 2D List