Skip to main content
Improved formatting
Source Link
m_goldberg
  • 108.1k
  • 16
  • 104
  • 259

Dealing with FindDistribution Parameters when the extract parameter results are clearly wrongunexpected behavior of FindDistributionParameters

I want to extract the distribution parameters for a set of data. I know what the distribution is. However, I find that for different sets or even subsets of this data the values of the extracted distribution using FindDistributionParameters[Data, Distribution] fluctuate quite a lot.

To test this I made a small simulation:

TestData = RandomVariate[WeibullDistribution[84.2, 366.9, -494.9], 10000];
    
TestDistParams = 
  {\[Alpha]WαW, \[Beta]WβW, \[Gamma]WγW} /. FindDistributionParameters[TestData
    FindDistributionParameters[
      TestData, WeibullDistribution[\[Alpha]W
      WeibullDistribution[αW, \[Beta]WβW, \[Gamma]W]γW], 
      {{\[Alpha]WαW, 84.2}, {\[Beta]WβW, 366.9}, {\[Gamma]WγW, -494.9}}]
 
Show[
        {
          Show[
  {Histogram[TestData, {"Raw", Round[Sqrt[Length[TestData]]]}],
       Plot[
     Plot[PDF[WeibullDistribution[TestDistParams[[1]]PDF[WeibullDistribution[TestDistParams[[1]], TestDistParams[[2]], TestDistParams[[3]]]][x], 
     {x, -160, -115}]
        }
    ]

What I find is that the output of FindDistributionParameters[..] fluctuates quite a lot, sometimes the extracted parameters are twice as large as those input into generating the test distribution -- sometimes more so. This is even case when simulating with a large sample (10000 points) and when initialising FindDistributionParameters with guesses exactly as that used to generate the distribution.

What I have found to be far more robust is actually just finding the values of the centre bins with the corresponding PDF value or count, and using NonlinearModelFit to this.

What is the best approach of accurately extracting distribution parameters from a data set, reliably and accurately? Can one use constraints in a similar way to fitting?


On the advice of an experience user, I am adding a specific example. If I use a fixed set of random numbers with SeedRandom[123456]

Using the same code as above I get for SeedRandom[123456] --> {148.383, 653.1, -781.061}. This one is so bad that the plotted PDF is just completely off.

or if I choose another seed, say SeedRandom[851] --> 5.54576*10^6, 2.41777*10^7, -2.41778*10^7

Both examples are for a sample set of 10000 points.


To rephrase my question a little more carefully

To rephrase my question a little more carefully

My question specifically relates to dealing with FindDistributionParameters when the results are clearly too far off to be considered as part of normal statistical fluctuation (see above examples with fixed seeds) but when the data itself definitely reflects the distribution one is trying to match to it. I.e. when it is specifically drawn from that distribution. Are there constraints one can use for example?

Dealing with FindDistribution Parameters when the extract parameter results are clearly wrong

I want to extract the distribution parameters for a set of data. I know what the distribution is. However I find that for different sets or even subsets of this data the values of the extracted distribution using FindDistributionParameters[Data, Distribution] fluctuate quite a lot.

To test this I made a small simulation:

TestData = RandomVariate[WeibullDistribution[84.2, 366.9, -494.9], 10000];

TestDistParams = {\[Alpha]W, \[Beta]W, \[Gamma]W} /. FindDistributionParameters[TestData, WeibullDistribution[\[Alpha]W, \[Beta]W, \[Gamma]W], {{\[Alpha]W, 84.2}, {\[Beta]W, 366.9}, {\[Gamma]W, -494.9}}]
 
Show[
        {
            Histogram[TestData,{"Raw", Round[Sqrt[Length[TestData]]]}],
            Plot[PDF[WeibullDistribution[TestDistParams[[1]], TestDistParams[[2]], TestDistParams[[3]]]][x],{x, -160, -115}]
        }
    ]

What I find is that the output of FindDistributionParameters[..] fluctuates quite a lot, sometimes the extracted parameters are twice as large as those input into generating the test distribution -- sometimes more so. This is even case when simulating with a large sample (10000 points) and when initialising FindDistributionParameters with guesses exactly as that used to generate the distribution.

What I have found to be far more robust is actually just finding the values of the centre bins with the corresponding PDF value or count, and using NonlinearModelFit to this.

What is the best approach of accurately extracting distribution parameters from a data set, reliably and accurately? Can one use constraints in a similar way to fitting?


On the advice of an experience user I am adding a specific example. If I use a fixed set of random numbers with SeedRandom[123456]

Using the same code as above I get for SeedRandom[123456] --> {148.383, 653.1, -781.061}. This one is so bad that the plotted PDF is just completely off.

or if I choose another seed, say SeedRandom[851] --> 5.54576*10^6, 2.41777*10^7, -2.41778*10^7

Both examples are for a sample set of 10000 points.


To rephrase my question a little more carefully

My question specifically relates to dealing with FindDistributionParameters when the results are clearly too far off to be considered as part of normal statistical fluctuation (see above examples with fixed seeds) but when the data itself definitely reflects the distribution one is trying to match to it. I.e. when it is specifically drawn from that distribution. Are there constraints one can use for example?

Dealing unexpected behavior of FindDistributionParameters

I want to extract the distribution parameters for a set of data. I know what the distribution is. However, I find that for different sets or even subsets of this data the values of the extracted distribution using FindDistributionParameters[Data, Distribution] fluctuate quite a lot.

To test this I made a small simulation:

TestData = RandomVariate[WeibullDistribution[84.2, 366.9, -494.9], 10000];
    
TestDistParams = 
  {αW, βW, γW} /. 
    FindDistributionParameters[
      TestData, 
      WeibullDistribution[αW, βW, γW], 
      {{αW, 84.2}, {βW, 366.9}, {γW, -494.9}}]
    
Show[
  {Histogram[TestData, {"Raw", Round[Sqrt[Length[TestData]]]}],
   Plot[
     PDF[WeibullDistribution[TestDistParams[[1]], TestDistParams[[2]], TestDistParams[[3]]]][x], 
     {x, -160, -115}]}]

What I find is that the output of FindDistributionParameters[..] fluctuates quite a lot, sometimes the extracted parameters are twice as large as those input into generating the test distribution -- sometimes more so. This is even case when simulating with a large sample (10000 points) and when initialising FindDistributionParameters with guesses exactly as that used to generate the distribution.

What I have found to be far more robust is actually just finding the values of the centre bins with the corresponding PDF value or count, and using NonlinearModelFit to this.

What is the best approach of accurately extracting distribution parameters from a data set, reliably and accurately? Can one use constraints in a similar way to fitting?


On the advice of an experience user, I am adding a specific example. If I use a fixed set of random numbers with SeedRandom[123456]

Using the same code as above I get for SeedRandom[123456] --> {148.383, 653.1, -781.061}. This one is so bad that the plotted PDF is just completely off.

or if I choose another seed, say SeedRandom[851] --> 5.54576*10^6, 2.41777*10^7, -2.41778*10^7

Both examples are for a sample set of 10000 points.


To rephrase my question a little more carefully

My question specifically relates to dealing with FindDistributionParameters when the results are clearly too far off to be considered as part of normal statistical fluctuation (see above examples with fixed seeds) but when the data itself definitely reflects the distribution one is trying to match to it. I.e. when it is specifically drawn from that distribution. Are there constraints one can use for example?

added 488 characters in body; edited title
Source Link
user27119
  • 2.5k
  • 13
  • 35

Extracting Dealing with FindDistribution Parameters when the parameters of a distribution using FindDistributionParameters[...], or suggestions for a better approachextract parameter results are clearly wrong

I want to extract the distribution parameters for a set of data. I know what the distribution is. However I find that for different sets or even subsets of this data the values of the extracted distribution using FindDistributionParameters[Data, Distribution] fluctuate quite a lot.

To test this I made a small simulation:

TestData = RandomVariate[WeibullDistribution[84.2, 366.9, -494.9], 10000];

TestDistParams = {\[Alpha]W, \[Beta]W, \[Gamma]W} /. FindDistributionParameters[TestData, WeibullDistribution[\[Alpha]W, \[Beta]W, \[Gamma]W], {{\[Alpha]W, 84.2}, {\[Beta]W, 366.9}, {\[Gamma]W, -494.9}}]

Show[
        {
            Histogram[TestData,{"Raw", Round[Sqrt[Length[TestData]]]}],
            Plot[PDF[WeibullDistribution[TestDistParams[[1]], TestDistParams[[2]], TestDistParams[[3]]]][x],{x, -160, -115}]
        }
    ]

What I find is that the output of FindDistributionParameters[..] fluctuates quite a lot, sometimes the extracted parameters are twice as large as those input into generating the test distribution -- sometimes more so. This is even case when simulating with a large sample (10000 points) and when initialising FindDistributionParameters with guesses exactly as that used to generate the distribution.

What I have found to be far more robust is actually just finding the values of the centre bins with the corresponding PDF value or count, and using NonlinearModelFit to this.

What is the best approach of accurately extracting distribution parameters from a data set, reliably and accurately? Can one use constraints in a similar way to fitting?


On the advice of an experience user I am adding a specific example. If I use a fixed set of random numbers with SeedRandom[123456]

Using the same code as above I get for SeedRandom[123456] --> {148.383, 653.1, -781.061}. This one is so bad that the plotted PDF is just completely off.

or if I choose another seed, say SeedRandom[851] --> 5.54576*10^6, 2.41777*10^7, -2.41778*10^7

Both examples are for a sample set of 10000 points.


To rephrase my question a little more carefully

My question specifically relates to dealing with FindDistributionParameters when the results are clearly too far off to be considered as part of normal statistical fluctuation (see above examples with fixed seeds) but when the data itself definitely reflects the distribution one is trying to match to it. I.e. when it is specifically drawn from that distribution. Are there constraints one can use for example?

Extracting the parameters of a distribution using FindDistributionParameters[...], or suggestions for a better approach

I want to extract the distribution parameters for a set of data. I know what the distribution is. However I find that for different sets or even subsets of this data the values of the extracted distribution using FindDistributionParameters[Data, Distribution] fluctuate quite a lot.

To test this I made a small simulation:

TestData = RandomVariate[WeibullDistribution[84.2, 366.9, -494.9], 10000];

TestDistParams = {\[Alpha]W, \[Beta]W, \[Gamma]W} /. FindDistributionParameters[TestData, WeibullDistribution[\[Alpha]W, \[Beta]W, \[Gamma]W], {{\[Alpha]W, 84.2}, {\[Beta]W, 366.9}, {\[Gamma]W, -494.9}}]

Show[
        {
            Histogram[TestData,{"Raw", Round[Sqrt[Length[TestData]]]}],
            Plot[PDF[WeibullDistribution[TestDistParams[[1]], TestDistParams[[2]], TestDistParams[[3]]]][x],{x, -160, -115}]
        }
    ]

What I find is that the output of FindDistributionParameters[..] fluctuates quite a lot, sometimes the extracted parameters are twice as large as those input into generating the test distribution -- sometimes more so. This is even case when simulating with a large sample (10000 points) and when initialising FindDistributionParameters with guesses exactly as that used to generate the distribution.

What I have found to be far more robust is actually just finding the values of the centre bins with the corresponding PDF value or count, and using NonlinearModelFit to this.

What is the best approach of accurately extracting distribution parameters from a data set, reliably and accurately? Can one use constraints in a similar way to fitting?


On the advice of an experience user I am adding a specific example. If I use a fixed set of random numbers with SeedRandom[123456]

Using the same code as above I get for SeedRandom[123456] --> {148.383, 653.1, -781.061}. This one is so bad that the plotted PDF is just completely off.

or if I choose another seed, say SeedRandom[851] --> 5.54576*10^6, 2.41777*10^7, -2.41778*10^7

Both examples are for a sample set of 10000 points.

Dealing with FindDistribution Parameters when the extract parameter results are clearly wrong

I want to extract the distribution parameters for a set of data. I know what the distribution is. However I find that for different sets or even subsets of this data the values of the extracted distribution using FindDistributionParameters[Data, Distribution] fluctuate quite a lot.

To test this I made a small simulation:

TestData = RandomVariate[WeibullDistribution[84.2, 366.9, -494.9], 10000];

TestDistParams = {\[Alpha]W, \[Beta]W, \[Gamma]W} /. FindDistributionParameters[TestData, WeibullDistribution[\[Alpha]W, \[Beta]W, \[Gamma]W], {{\[Alpha]W, 84.2}, {\[Beta]W, 366.9}, {\[Gamma]W, -494.9}}]

Show[
        {
            Histogram[TestData,{"Raw", Round[Sqrt[Length[TestData]]]}],
            Plot[PDF[WeibullDistribution[TestDistParams[[1]], TestDistParams[[2]], TestDistParams[[3]]]][x],{x, -160, -115}]
        }
    ]

What I find is that the output of FindDistributionParameters[..] fluctuates quite a lot, sometimes the extracted parameters are twice as large as those input into generating the test distribution -- sometimes more so. This is even case when simulating with a large sample (10000 points) and when initialising FindDistributionParameters with guesses exactly as that used to generate the distribution.

What I have found to be far more robust is actually just finding the values of the centre bins with the corresponding PDF value or count, and using NonlinearModelFit to this.

What is the best approach of accurately extracting distribution parameters from a data set, reliably and accurately? Can one use constraints in a similar way to fitting?


On the advice of an experience user I am adding a specific example. If I use a fixed set of random numbers with SeedRandom[123456]

Using the same code as above I get for SeedRandom[123456] --> {148.383, 653.1, -781.061}. This one is so bad that the plotted PDF is just completely off.

or if I choose another seed, say SeedRandom[851] --> 5.54576*10^6, 2.41777*10^7, -2.41778*10^7

Both examples are for a sample set of 10000 points.


To rephrase my question a little more carefully

My question specifically relates to dealing with FindDistributionParameters when the results are clearly too far off to be considered as part of normal statistical fluctuation (see above examples with fixed seeds) but when the data itself definitely reflects the distribution one is trying to match to it. I.e. when it is specifically drawn from that distribution. Are there constraints one can use for example?

added 466 characters in body
Source Link
user27119
  • 2.5k
  • 13
  • 35

I want to extract the distribution parameters for a set of data. I know what the distribution is. However I find that for different sets or even subsets of this data the values of the extracted distribution using FindDistributionParameters[Data, Distribution] fluctuate quite a lot.

To test this I made a small simulation:

TestData = RandomVariate[WeibullDistribution[84.2, 366.9, -494.9], 10000];

TestDistParams = {\[Alpha]W, \[Beta]W, \[Gamma]W} /. FindDistributionParameters[TestData, WeibullDistribution[\[Alpha]W, \[Beta]W, \[Gamma]W], {{\[Alpha]W, 84.2}, {\[Beta]W, 366.9}, {\[Gamma]W, -494.9}}]

Show[
        {
            Histogram[TestData,{"Raw", Round[Sqrt[Length[TestData]]]}],
            Plot[PDF[WeibullDistribution[TestDistParams[[1]], TestDistParams[[2]], TestDistParams[[3]]]][x],{x, -160, -115}]
        }
    ]

What I find is that the output of FindDistributionParameters[..] fluctuates quite a lot, sometimes the extracted parameters are twice as large as those input into generating the test distribution -- sometimes more so. This is even case when simulating with a large sample (10000 points) and when initialising FindDistributionParameters with guesses exactly as that used to generate the distribution.

What I have found to be far more robust is actually just finding the values of the centre bins with the corresponding PDF value or count, and using NonlinearModelFit to this.

What is the best approach of accurately extracting distribution parameters from a data set, reliably and accurately? Can one use constraints in a similar way to fitting?


On the advice of an experience user I am adding a specific example. If I use a fixed set of random numbers with SeedRandom[123456]

Using the same code as above I get for SeedRandom[123456] --> {148.383, 653.1, -781.061}. This one is so bad that the plotted PDF is just completely off.

or if I choose another seed, say SeedRandom[851] --> 5.54576*10^6, 2.41777*10^7, -2.41778*10^7

Both examples are for a sample set of 10000 points.

I want to extract the distribution parameters for a set of data. I know what the distribution is. However I find that for different sets or even subsets of this data the values of the extracted distribution using FindDistributionParameters[Data, Distribution] fluctuate quite a lot.

To test this I made a small simulation:

TestData = RandomVariate[WeibullDistribution[84.2, 366.9, -494.9], 10000];

TestDistParams = {\[Alpha]W, \[Beta]W, \[Gamma]W} /. FindDistributionParameters[TestData, WeibullDistribution[\[Alpha]W, \[Beta]W, \[Gamma]W], {{\[Alpha]W, 84.2}, {\[Beta]W, 366.9}, {\[Gamma]W, -494.9}}]

Show[
        {
            Histogram[TestData,{"Raw", Round[Sqrt[Length[TestData]]]}],
            Plot[PDF[WeibullDistribution[TestDistParams[[1]], TestDistParams[[2]], TestDistParams[[3]]]][x],{x, -160, -115}]
        }
    ]

What I find is that the output of FindDistributionParameters[..] fluctuates quite a lot, sometimes the extracted parameters are twice as large as those input into generating the test distribution -- sometimes more so. This is even case when simulating with a large sample (10000 points) and when initialising FindDistributionParameters with guesses exactly as that used to generate the distribution.

What I have found to be far more robust is actually just finding the values of the centre bins with the corresponding PDF value or count, and using NonlinearModelFit to this.

What is the best approach of accurately extracting distribution parameters from a data set, reliably and accurately? Can one use constraints in a similar way to fitting?

I want to extract the distribution parameters for a set of data. I know what the distribution is. However I find that for different sets or even subsets of this data the values of the extracted distribution using FindDistributionParameters[Data, Distribution] fluctuate quite a lot.

To test this I made a small simulation:

TestData = RandomVariate[WeibullDistribution[84.2, 366.9, -494.9], 10000];

TestDistParams = {\[Alpha]W, \[Beta]W, \[Gamma]W} /. FindDistributionParameters[TestData, WeibullDistribution[\[Alpha]W, \[Beta]W, \[Gamma]W], {{\[Alpha]W, 84.2}, {\[Beta]W, 366.9}, {\[Gamma]W, -494.9}}]

Show[
        {
            Histogram[TestData,{"Raw", Round[Sqrt[Length[TestData]]]}],
            Plot[PDF[WeibullDistribution[TestDistParams[[1]], TestDistParams[[2]], TestDistParams[[3]]]][x],{x, -160, -115}]
        }
    ]

What I find is that the output of FindDistributionParameters[..] fluctuates quite a lot, sometimes the extracted parameters are twice as large as those input into generating the test distribution -- sometimes more so. This is even case when simulating with a large sample (10000 points) and when initialising FindDistributionParameters with guesses exactly as that used to generate the distribution.

What I have found to be far more robust is actually just finding the values of the centre bins with the corresponding PDF value or count, and using NonlinearModelFit to this.

What is the best approach of accurately extracting distribution parameters from a data set, reliably and accurately? Can one use constraints in a similar way to fitting?


On the advice of an experience user I am adding a specific example. If I use a fixed set of random numbers with SeedRandom[123456]

Using the same code as above I get for SeedRandom[123456] --> {148.383, 653.1, -781.061}. This one is so bad that the plotted PDF is just completely off.

or if I choose another seed, say SeedRandom[851] --> 5.54576*10^6, 2.41777*10^7, -2.41778*10^7

Both examples are for a sample set of 10000 points.

Source Link
user27119
  • 2.5k
  • 13
  • 35
Loading