Accord.Statistics.Testing.Power.BaseTwoSamplePowerAnalysis.ComputeEffect C# (CSharp) Method

ComputeEffect() public method

Computes the minimum detectable effect size for the test considering the power given in Power, the number of samples in TotalSamples and the significance level Size.
public ComputeEffect ( ) : void
return void
        public virtual void ComputeEffect()
        {
            double requiredPower = Power;

            // Attempt to locate the optimal sample size
            // to attain the required power by locating
            // a zero in the difference function:

            double sol = BrentSearch.FindRoot(eff =>
            {
                Effect = eff;
                ComputePower();

                return requiredPower - Power;
            },

            lowerBound: 1e-5,
            upperBound: 1e+5);


            // Check it
            Effect = sol;
            ComputePower();

            double newPower = Power;
            Power = requiredPower;

            if (Math.Abs(requiredPower - newPower) > 1e-5)
                Effect = Double.NaN;
        }