Re: Fitting question
- To: mathgroup at smc.vnet.net
- Subject: [mg51605] Re: Fitting question
- From: D Herring <dherring at at.uiuc.dot.edu>
- Date: Wed, 27 Oct 2004 01:54:08 -0400 (EDT)
- References: <cldov3$4a8$1@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
(* How's this? *) (* Given data *) runtotpergen = {1, 23, 136, 568, 1735, 4382, 9099, 16384, 25993, 36694, 47752, 58044, 66761, 73534, 78429, 81753, 83750, 84873, 85482, 85779, 85937, 86025, 86069, 86081, 86087}; totpergen = {1, 22, 113, 432, 1167, 2647, 4717, 7285, 9609, 10701, 11058, 10292, 8717, 6773, 4895, 3324, 1997, 1123, 609, 297, 158, 88, 44, 12, 6}; ListPlot[totpergen]; (* Do the fit *) << Statistics`ContinuousDistributions` soln = FindFit[totpergen, a*PDF[NormalDistribution[b, c], x], {a, {b, 12}, c}, x] Plot[a*PDF[NormalDistribution[b, c], x] /. soln, {x, 0, 25}]; (* Check the fit error *) err = Table[ totpergen[[i]] - (a*PDF[NormalDistribution[b, c], x] /. soln) /. x -> i, {i, 25}]; ListPlot[err]; relerr = err/totpergen; ListPlot[relerr]; (* Hope that helps. -- Daniel *)