# Using FindDistributionParameters in a discrete region of parameters

Posted 8 years ago
6214 Views
|
|
0 Total Likes
|
 Hi, first of all, This is my first post so sorry if I am doing anything wrong-please let me know if I do so I can fix it in the next time.Now for the problem: I have created a distribution as follows:  gauss[\[Sigma]_, Nelec_, Nevents_][S2_] := Nevents/Sqrt[2 \[Pi] Nelec*\[Sigma]^2] E^(- (S2 - Nelec)^2/( 2 Nelec \[Sigma]^2)); histo0 := {0, 3, 2, 0, 2, 0, 2, 1, 0, 0, 1, 0, 0, 1, 1, 0, 0, 0, 0, 2, 0, 0, 0, 0, 1, 2, 0, 1, 1, 1, 1, 2, 0, 1, 0, 0, 1, 1, 0, 0, 1}; totali[S2_] := Sum[gauss[\[Sigma], n, histo0[[n - 2]] + dn[n - 3]][S2], {n, 4, 42}]; int=Integrate[totali[S2], {S2, 2, 47}]; MyDis = ProbabilityDistribution[totali[S2]/int, {S2, 2, 47}]; Basically, What I did is sum a few Gaussian distributions, where the mean is a natural number between 4 and 42, and the standard deviation is a positive variable $\sigma$ times the square root of the mean. Each gaussian distribution is multiplied by a non-negetive integer, where histo0 is my initial guess, and dn[n] is "how wrong" I am. I want to fit the parameters to the following data: MyData := {3.55, 3.929612637855687, 4.198861253938525, 4.772217586600313, 4.86366648742909, 6.766448860938332, 6.948322072316817, 8.89701146228973, 9.409033926355143, 9.636778566425097, 13.261158408037534, 15.582422423427438, 17.146213657293824, 22.437562769783195, 22.47612166533075, 26.751597041651493, 28.015997164367814, 28.107911510263797, 30.27938610839986, 31.15744941537931, 31.88040495283035, 33.0687273993196, 33.50485819234863, 33.813167859728125, 35.66914520018869, 39.14112642715986, 40.4114737998406, 42.51464449681805}; However, It is crucial that "dn" will remain integers. I can use $\sigma$=0.23, but I'd rather claculate it from the fit. When I took $\sigma$=0.23, I tried using:  FindDistributionParameters[MyData, MyDis, {{dn[1], 0}, {dn[2], 0}, {dn[3], 0}, {dn[4], 0}, {dn[5], 0}, {dn[6], 0}, {dn[7], 0}, {dn[8], 0}, {dn[9], 0}, {dn[10], 0}, {dn[11], 0}, {dn[12], 0}, {dn[13], 0}, {dn[14], 0}, {dn[15], 0}, {dn[16], 0}, {dn[17], 0}, {dn[18], 0}, {dn[19], 0}, {dn[20], 0}, {dn[21], 0}, {dn[22], 0}, {dn[23], 0}, {dn[24], 0}, {dn[25], 0}, {dn[26], 0}, {dn[27], 0}, {dn[28], 0}, {dn[29], 0}, {dn[30], 0}, {dn[31], 0}, {dn[32], 0}, {dn[33], 0}, {dn[34], 0}, {dn[35], 0}, {dn[36], 0}, {dn[37], 0}, {dn[38], 0},{dn[39],0}}, AccuracyGoal -> 0, PrecisionGoal -> 0] `But it just gave me zeros. I also tried with the accuracy goal goes to 1, and that did not give me integers. Is there any way to determine the best "dn"s, from the region {-2,-1,0,1,2}, while taking a positive sigma smaller than 1? Thanks In advance.