Examples - pi.science.distribution.PINormalDistribution
1. How to compute Normal distribution propability for X ?
PINormalDistribution distribution = new PINormalDistribution(); /* -- get probability from Z-score */ Console.WriteLine( "Probability for x=0 : " + distribution.GetProbability( 0.0 ) ); Console.WriteLine( "Probability for x=-1 : " + distribution.GetProbability( -1.0 ) ); Console.WriteLine( "Probability for x=1 : " + distribution.GetProbability( 1.0 ) ); Console.WriteLine( "Probability for x=-5 : " + distribution.GetProbability( -5.0 ) ); Console.WriteLine( "Probability for x=5 : " + distribution.GetProbability( 5.0 ) );
Output:
Probability for x=0 : 0,5 Probability for x=-1 : 0,158655253655632 Probability for x=1 : 0,841344746344368 Probability for x=-5 : 0 Probability for x=5 : 1
2. How to compute X for Normal distribution propability ?
PINormalDistribution distribution = new PINormalDistribution(); Console.WriteLine( "x for probability=0.5 : " + distribution.GetXForProbability( 0.5 ) ); Console.WriteLine( "x for probability=0.15 : " + distribution.GetXForProbability( 0.1586 ) ); Console.WriteLine( "x for probability=0.8413 : " + distribution.GetXForProbability( 0.8413 ) ); Console.WriteLine( "x for probability=0.0001 : " + distribution.GetXForProbability( 0.0001 ) ); Console.WriteLine( "x for probability=0.9999 : " + distribution.GetXForProbability( 0.9999 ) ); Console.WriteLine( "x for probability=0.0 : " + distribution.GetXForProbability( 0.0 ) ); Console.WriteLine( "x for probability=1.0 : " + distribution.GetXForProbability( 1.0 ) );
Output:
x for probability=0.5 : 2,98023223876953E-07 x for probability=0.15 : -1,00022822618484 x for probability=0.8413 : 0,999815165996552 x for probability=0.0001 : -3,71901661157608 x for probability=0.9999 : 3,71901661157608 x for probability=0.0 : 10 x for probability=1.0 : 0
3. How to compute Normal probability density for X (=curve points) ?
PINormalDistribution distribution = new PINormalDistribution(); Console.WriteLine( "Probability density, x=-3 = " + distribution.CalcProbabilityDensity( -3 ) ); Console.WriteLine( "Probability density, x=0 = " + distribution.CalcProbabilityDensity( 0 ) ); Console.WriteLine( "Probability density, x=3 = " + distribution.CalcProbabilityDensity( 3 ) );
Output:
Probability density, x=-3 = 0,0278461248255361 Probability density, x=0 = 2,506628274631 Probability density, x=3 = 0,0278461248255361 