Accord.Statistics.Testing.Power.ZTestPowerAnalysis.GetSampleSize C# (CSharp) Method

GetSampleSize() public static method

Estimates the number of samples necessary to attain the required power level for the given effect size.
public static GetSampleSize ( double delta, double standardDeviation = 1, double power = 0.8, double alpha = 0.05, OneSampleHypothesis hypothesis = OneSampleHypothesis.ValueIsDifferentFromHypothesis ) : ZTestPowerAnalysis
delta double The minimum detectable difference.
standardDeviation double The difference standard deviation.
power double The desired power level. Default is 0.8.
alpha double The desired significance level. Default is 0.05.
hypothesis OneSampleHypothesis The alternative hypothesis (research hypothesis) to be tested.
return ZTestPowerAnalysis
        public static ZTestPowerAnalysis GetSampleSize(double delta,
            double standardDeviation = 1, double power = 0.8, double alpha = 0.05,
           OneSampleHypothesis hypothesis = OneSampleHypothesis.ValueIsDifferentFromHypothesis)
        {
            ZTestPowerAnalysis analysis = new ZTestPowerAnalysis(hypothesis)
            {
                Effect = (delta) / standardDeviation,
                Size = alpha,
                Power = power,
            };

            analysis.ComputeSamples();

            return analysis;
        }