17.1.10.3 Algorithms (Distribution Fit)
distribution-fit-Algorithm 
 
Use the Distribution Fit to fit a distribution to a variable.
 There are seven distributions can be used to fit a given variable. We calculate the Maximum Likelihood Estimation(MLE) as parameters estimators. For some continuous distributions, we not only give Confidence Limit but also offer Goodness of Fit test.
 
Distributions and Maximum Likelihood Estimation(MLE)
Normal Distribution
PDF
![\frac{1}{\sqrt{2\pi \sigma^2}}\exp [-\frac{(x-\mu)^2}{2\sigma^2}] \frac{1}{\sqrt{2\pi \sigma^2}}\exp [-\frac{(x-\mu)^2}{2\sigma^2}]](//d2mvzyuse3lwjc.cloudfront.net/doc/en/UserGuide/images/Algorithm(Distribution_Fit)/math-7185152b716035521a23a68b77203be4.png?v=0) 
  
where   and  . With   and  .
 
Maximum Likelihood Estimation(MLE)
Parameters
   
-  
 .  
Confidence Intervals
The confidence interval for   and   are:
 
![\left[ \hat{\mu} - z \hat{\mu}_{se}, \hat{\mu} + z\hat{\mu}_{se} \right] \left[ \hat{\mu} - z \hat{\mu}_{se}, \hat{\mu} + z\hat{\mu}_{se} \right]](//d2mvzyuse3lwjc.cloudfront.net/doc/en/UserGuide/images/Algorithm(Distribution_Fit)/math-ce2e8d2b0c42adb8837e69b4adc2606e.png?v=0)  
![\left[ \frac{\hat{\sigma}}{\exp \left[ (z \hat{\sigma}_{se})/\hat{\sigma} \right]},\hat{\sigma}\exp \left[ (z \hat{\sigma}_{se})/\hat{\sigma} \right] \right] \left[ \frac{\hat{\sigma}}{\exp \left[ (z \hat{\sigma}_{se})/\hat{\sigma} \right]},\hat{\sigma}\exp \left[ (z \hat{\sigma}_{se})/\hat{\sigma} \right] \right]](//d2mvzyuse3lwjc.cloudfront.net/doc/en/UserGuide/images/Algorithm(Distribution_Fit)/math-0535dfa29e418e5d578e22cbf35fee81.png?v=0)  
where   is the   critical value for the standard normal distribution in which   is the confidence level. And   is standard error for   while   is for  .
 
LogNormal Distribution
PDF
 , 
where   and  . With   and  .
 
Maximum Likelihood Estimation(MLE)
Parameters
/math-3ce36b54ba5e954002575e762522c35b.png?v=0)  
-  
 .  
Confidence Interval
The confidence interval for   and   are:
 
![\left[ \hat{\mu} - z \hat{\mu}_{se}, \hat{\mu} + z \hat{\mu}_{se} \right] \left[ \hat{\mu} - z \hat{\mu}_{se}, \hat{\mu} + z \hat{\mu}_{se} \right]](//d2mvzyuse3lwjc.cloudfront.net/doc/en/UserGuide/images/Algorithm(Distribution_Fit)/math-9f42c3e58301ad6809667e7761678ba3.png?v=0)  
![\left[ \frac{\hat{\sigma}}{\exp \left[ (z \hat{\sigma}_{se})/\hat{\sigma} \right]},\hat{\sigma}\exp \left[ (z \hat{\sigma}_{se})/\hat{\sigma} \right] \right] \left[ \frac{\hat{\sigma}}{\exp \left[ (z \hat{\sigma}_{se})/\hat{\sigma} \right]},\hat{\sigma}\exp \left[ (z \hat{\sigma}_{se})/\hat{\sigma} \right] \right]](//d2mvzyuse3lwjc.cloudfront.net/doc/en/UserGuide/images/Algorithm(Distribution_Fit)/math-0535dfa29e418e5d578e22cbf35fee81.png?v=0)  
where   is the   critical value for the standard normal distribution in which   is the confidence level. And   is standard error for   while   is for  .
 
Weibull Distribution
PDF
![\frac{\beta}{\alpha^\beta}x^{\beta -1} exp\left[ -\left(\frac{x}{\alpha}\right)^\beta\right], \frac{\beta}{\alpha^\beta}x^{\beta -1} exp\left[ -\left(\frac{x}{\alpha}\right)^\beta\right],](//d2mvzyuse3lwjc.cloudfront.net/doc/en/UserGuide/images/Algorithm(Distribution_Fit)/math-930e3969310050c9b005c63c3e55c587.png?v=0)  
where  . With   and  .
 
Maximum Likelihood Estimation(MLE)
Origin calls a NAG function nag_estim_weibull (g07bec), for the MLE of statistics of weibull distribution. Please refer to related NAG document, for more details on the algorithm.
 
Exponential Distribution
PDF
 , 
where   and  . With   and  .
 
Maximum Likelihood Estimation(MLE)
Parameters
 
 
Confidence Interval
The confidence interval for   is:
 
![\left[ \frac{\hat{\sigma}}{\exp \left[ (z \hat{\sigma}_{se})/\hat{\sigma} \right]},\hat{\sigma}\exp \left[ (z \hat{\sigma}_{se})/\hat{\sigma} \right] \right] \left[ \frac{\hat{\sigma}}{\exp \left[ (z \hat{\sigma}_{se})/\hat{\sigma} \right]},\hat{\sigma}\exp \left[ (z \hat{\sigma}_{se})/\hat{\sigma} \right] \right]](//d2mvzyuse3lwjc.cloudfront.net/doc/en/UserGuide/images/Algorithm(Distribution_Fit)/math-0535dfa29e418e5d578e22cbf35fee81.png?v=0)  
where   is the   critical value for the standard normal distribution in which   is the confidence level. And   is standard error for  .
 
Gamma Distribution
PDF
/math-353d8a8e32ffc83a95afced239dffabb.png?v=0)  
where  . With   and  .
 
Maximum Likelihood Estimation(MLE)
Parameters
It's not easy to calculate MLE of   and   by hand. But with Newton-Raphson method, we can easily get what we want. In order to obtain good root of likelihood equation, we need to offer a proper initial estimator, which can be given by:
 
 
Confidence Interval
The confidence interval for   and   are:
 
![\left[ \hat{\alpha} - z \hat{\alpha}_{se}, \hat{\alpha} + z\hat{\alpha}_{se} \right] \left[ \hat{\alpha} - z \hat{\alpha}_{se}, \hat{\alpha} + z\hat{\alpha}_{se} \right]](//d2mvzyuse3lwjc.cloudfront.net/doc/en/UserGuide/images/Algorithm(Distribution_Fit)/math-0db75f463c71582cbdca0e76f50541cc.png?v=0)  
![\left[ \frac{\hat{\theta}}{\exp \left[ (z \hat{\theta}_{se})/\hat{\theta} \right]},\hat{\theta}\exp \left[ (z \hat{\theta}_{se})/\hat{\theta} \right] \right] \left[ \frac{\hat{\theta}}{\exp \left[ (z \hat{\theta}_{se})/\hat{\theta} \right]},\hat{\theta}\exp \left[ (z \hat{\theta}_{se})/\hat{\theta} \right] \right]](//d2mvzyuse3lwjc.cloudfront.net/doc/en/UserGuide/images/Algorithm(Distribution_Fit)/math-7d5a0986370f7911ef882a0e600e072e.png?v=0)  
where   is the   critical value for the standard normal distribution in which   is the confidence level. And   is standard error for   while   is for  .
 
Binomial Distribution
PDF
/math-313a3bb44b8fb85a48fe2601a729ae2c.png?v=0)  
where   and  . With   and  .
Given a number of success   and sample size  
 
Maximum Likelihood Estimation(MLE)
Parameters
 
 
Confidence Interval
![\left[\frac{1}{1+z^2/n}\left(\hat{p}+\frac{z^2}{2n} - z \sqrt{\frac{1}{n}\hat{p}(1-\hat{p})+\frac{z^2}{4n^2}}\right),\frac{1}{1+z^2/n}\left(\hat{p}+\frac{z^2}{2n} + z \sqrt{\frac{1}{n}\hat{p}(1-\hat{p})+\frac{z^2}{4n^2}}\right)\right] \left[\frac{1}{1+z^2/n}\left(\hat{p}+\frac{z^2}{2n} - z \sqrt{\frac{1}{n}\hat{p}(1-\hat{p})+\frac{z^2}{4n^2}}\right),\frac{1}{1+z^2/n}\left(\hat{p}+\frac{z^2}{2n} + z \sqrt{\frac{1}{n}\hat{p}(1-\hat{p})+\frac{z^2}{4n^2}}\right)\right]](//d2mvzyuse3lwjc.cloudfront.net/doc/en/UserGuide/images/Algorithm(Distribution_Fit)/math-f3d50d49217ea8b0292780d0368d1468.png?v=0)  
where   is the   critical value for the standard normal distribution in which   is the confidence level.
 
Possion Distribution
PDF
/math-bcbf3ebb2bb81a74b70f00c2720a5ab8.png?v=0)  
where  . With  .
 
Maximum Likelihood Estimation(MLE)
Parameters
 .
 
Confidence Interval
The confidence interval for   are:
 
![\left[ \hat{\lambda} - z \sqrt{\hat{\lambda}}, \hat{\lambda} + z \sqrt{\hat{\lambda}} \right] \left[ \hat{\lambda} - z \sqrt{\hat{\lambda}}, \hat{\lambda} + z \sqrt{\hat{\lambda}} \right]](//d2mvzyuse3lwjc.cloudfront.net/doc/en/UserGuide/images/Algorithm(Distribution_Fit)/math-c48a8dbb31f94b38dff287f355edda4d.png?v=0)  
where   is the   critical value for the standard normal distribution in which   is the confidence level.
 
Goodness of Fit
Kolmogorov-Smirnov
Origin calls a NAG function nag_1_sample_ks_test (g08cbc) , to compute the statistics. Please refer to related NAG document, for more details on the algorithm.
 
Kolmogorov-Smirnov(Modified)
-  Modified Kolmogorov-Smirnov Statistic
  
The modified Kolmogorov-Smirnov statisticis a modification of the Kolmogorov-Smirnov Statistic based on different distribution. 
 
The p-value for the Kolmogorov-Smirnov statistic is computed based on critical values table below, provided by D’Agostino and Stephens (1986). If the value of D is between two probability levels, then linear interpolation is used to estimate the p-value.
  
Here   is the Kolmogorov-Smirnov statistic
 
Normal/Lognormal Distribution
-  Modified Kolmogorov-Smirnov Statistic:
  
/math-c7904070be3a74d551bb739c1e1302aa.png?v=0)  
| D
 | 
<0.775 | 
0.775 | 
0.819 | 
0.895 | 
0.995 | 
1.035 | 
>1.035
 |  
| P-Value
 | 
>=0.15 | 
 0.15 | 
0.10 | 
0.05 | 
0.025 | 
0.01 | 
<=0.01
 |   
 
 
Weibull distribution
-  Modified Kolmogorov-Smirnov Statistic:
  
/math-840a6ff93f6a973714de5aefc582e522.png?v=0)  
| D
 | 
<1.372 | 
1.372 | 
1.477 | 
1.577 | 
1.671 | 
>1.671
 |  
| P-Value
 | 
 >=0.1 | 
0.1 | 
0.05 | 
0.025 | 
0.01 | 
<=0.01
 |   
Exponential Distribution
-  Modified Kolmogorov-Smirnov Statistic:
  
/math-51f418b7ba803de514cf1c2175443db6.png?v=0)  
| D
 | 
<0.926 | 
0.926 | 
0.995 | 
1.094 | 
1.184 | 
1.298 | 
>1.298
 |  
| P-Value
 | 
 >=0.15 | 
0.15 | 
0.10 | 
0.05 | 
0.025 | 
0.01 | 
<=0.01
 |   
 
 
Gamma Distribution
-  Modified Kolmogorov-Smirnov Statistic:
  
/math-b40216015b4648e578387227d5b2f4fa.png?v=0)  
| D
 | 
<0.74 | 
0.74 | 
0.780 | 
0.800 | 
0.858 | 
0.928 | 
0.990 | 
1.069 | 
1.13 | 
>1.13
 |  
| P-Value
 | 
 >=0.25 | 
0.25 | 
0.20 | 
0.15 | 
0.10 | 
0.05 | 
0.025 | 
0.01 | 
0.005 | 
<=0.005
 |   
Anderson-Darling
-  Anderson-Darling Statistics
  
![z=-N-\sum_{i=1}^n\frac{(2i-1)}{N}\left[lnF(Y_i)+ln(1-F(Y_{N+1-i})\right] z=-N-\sum_{i=1}^n\frac{(2i-1)}{N}\left[lnF(Y_i)+ln(1-F(Y_{N+1-i})\right]](//d2mvzyuse3lwjc.cloudfront.net/doc/en/UserGuide/images/Algorithm(Distribution_Fit)/math-d461965280138227f5da76f80d9689bd.png?v=0)  
- where
  is the cumulative distribution function of the specified distribution 
  are ordered data points: /math-c185391949923d8da4f48411bbf33384.png?v=0) 
  
  
-  P-value
- The p-value for the Adjusted  Anderson-Darling statistics is computed based on critical values table below, provided by D’Agostino and Stephens (1986). If the value of 
  is between two probability levels, then linear interpolation is used to estimate the p-value. 
   
Normal/Lognormal Distribution
-  Adjusted  Anderson-Darling Statistics
  
/math-6bf71347f7d61098150247a2bfda2084.png?v=0) 
  
/math-2a2b67918133d13a2817e65f322caf5c.png?v=0) 
  
Weibull distribution
-  Adjusted Anderson-Darling Statistics
-  
/math-bfd9a1456c6783613b0d73f4575e32e8.png?v=0)  
   
 
 | 
<0.474 | 
0.474 | 
0.637 | 
0.757 | 
0.877 | 
1.038 | 
>1.038
 |  
| P-Value
 | 
 >=0.25 | 
0.25 | 
0.10 | 
0.05 | 
0.025 | 
0.01 | 
<=0.01
 |   
Exponential Distribution
-  Adjusted Anderson-Darling Statistics
-  
/math-32701776e64a36ed14a21051a388193f.png?v=0)  
   
/math-1c9ae14bd39f8568fd2bb50af62206c8.png?v=0) 
  
 
 
Gamma Distribution
  
 
 | 
<0.486 | 
0.486 | 
0.657 | 
0.786 | 
0.917 | 
1.092 | 
1.227 | 
>1.227
 |  
| P-Value
 | 
 >=0.25 | 
0.25 | 
0.10 | 
0.05 | 
0.025 | 
0.01 | 
0.005 | 
<=0.005
 |   
 
 
  
 
 | 
<0.473 | 
0.473 | 
0.637 | 
0.759 | 
0.883 | 
1.048 | 
1.173 | 
>1.173
 |  
| P-Value
 | 
 >=0.25 | 
0.25 | 
0.10 | 
0.05 | 
0.025 | 
0.01 | 
0.005 | 
<=0.005
 |   
 
 
  
 
 | 
<0.470 | 
0.470 | 
0.631 | 
0.752 | 
0.873 | 
1.035 | 
1.159 | 
>1.159
 |  
| P-Value
 | 
 >=0.25 | 
0.25 | 
0.10 | 
0.05 | 
0.025 | 
0.01 | 
0.005 | 
<=0.005
 |   
Mean Test
Z-Test
Test Statistics
 
 where
 
-  
   
-  
 : The specified test mean 
 : The specified standard deviation
  
P-Value
The  , is returned based on an approximate Normal test statistics  .
  
 
Confidence Intervals
For the specified significance level, the confidence interval for the sample mean is:
 
| Null Hypothesis
 | 
Confidence Interval
 |  
 
 | 
  
 |  
 
 | 
  
 |  
 
 | 
  
 |   
T-Test
 Algorithms (One-Sample T-Test).
 
             |