Accord.Statistics.Testing.Power.BaseTwoSamplePowerAnalysis.ComputeSize C# (CSharp) 메소드

ComputeSize() 공개 메소드

Computes the minimum significance level for the test considering the power given in Power, the number of samples in TotalSamples and the effect size Effect.
public ComputeSize ( ) : void
리턴 void
        public virtual void ComputeSize()
        {
            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(alpha =>
            {
                Size = alpha;
                ComputePower();

                return requiredPower - Power;
            },

            lowerBound: 0,
            upperBound: 1);


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

            double newPower = Power;
            Power = requiredPower;

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