상속: BaseTwoSamplePowerAnalysis
예제 #1
0
        /// <summary>
        ///   Estimates the number of samples necessary to attain the
        ///   required power level for the given effect size.
        /// </summary>
        ///
        /// <param name="delta">The minimum detectable difference.</param>
        /// <param name="standardDeviation">The difference standard deviation.</param>
        /// <param name="power">The desired power level. Default is 0.8.</param>
        /// <param name="alpha">The desired significance level. Default is 0.05.</param>
        /// <param name="hypothesis">The alternative hypothesis (research hypothesis) to be tested.</param>
        /// <param name="proportion">The proportion of observations in the second group
        /// when compared to the first group. A proportion of 2:1 results in twice more
        /// samples in the second group than in the first. Default is 1.</param>
        ///
        /// <returns>The required number of samples.</returns>
        ///
        public static TwoSampleZTestPowerAnalysis GetSampleSize(double delta,
                                                                double standardDeviation       = 1, double proportion = 1.0, double power = 0.8, double alpha = 0.05,
                                                                TwoSampleHypothesis hypothesis = TwoSampleHypothesis.ValuesAreDifferent)
        {
            var analysis = new TwoSampleZTestPowerAnalysis(hypothesis)
            {
                Effect = (delta) / standardDeviation,
                Size   = alpha,
                Power  = power,
            };

            analysis.ComputeSamples(proportion);

            return(analysis);
        }
예제 #2
0
        /// <summary>
        ///   Estimates the number of samples necessary to attain the
        ///   required power level for the given effect size.
        /// </summary>
        ///
        /// <param name="sampleSize1">The number of observations in the first sample.</param>
        /// <param name="sampleSize2">The number of observations in the second sample.</param>
        /// <param name="power">The desired power level. Default is 0.8.</param>
        /// <param name="alpha">The desired significance level. Default is 0.05.</param>
        /// <param name="hypothesis">The alternative hypothesis (research hypothesis) to be tested.</param>
        ///
        /// <returns>The required number of samples.</returns>
        ///
        public static TwoSampleZTestPowerAnalysis GetEffectSize(int sampleSize1, int sampleSize2,
                                                                double power = 0.8, double alpha = 0.05,
                                                                TwoSampleHypothesis hypothesis = TwoSampleHypothesis.ValuesAreDifferent)
        {
            var analysis = new TwoSampleZTestPowerAnalysis(hypothesis)
            {
                Samples1 = sampleSize1,
                Samples2 = sampleSize2,
                Size     = alpha,
                Power    = power,
            };

            analysis.ComputeEffect();

            return(analysis);
        }
        /// <summary>
        ///   Estimates the number of samples necessary to attain the
        ///   required power level for the given effect size.
        /// </summary>
        /// 
        /// <param name="sampleSize1">The number of observations in the first sample.</param>
        /// <param name="sampleSize2">The number of observations in the second sample.</param>
        /// <param name="power">The desired power level. Default is 0.8.</param>
        /// <param name="alpha">The desired significance level. Default is 0.05.</param>
        /// <param name="hypothesis">The alternative hypothesis (research hypothesis) to be tested.</param>
        /// 
        /// <returns>The required number of samples.</returns>
        /// 
        public static TwoSampleZTestPowerAnalysis GetEffectSize(int sampleSize1, int sampleSize2,
            double power = 0.8, double alpha = 0.05,
            TwoSampleHypothesis hypothesis = TwoSampleHypothesis.ValuesAreDifferent)
        {
            var analysis = new TwoSampleZTestPowerAnalysis(hypothesis)
            {
                Samples1 = sampleSize1,
                Samples2 = sampleSize2,
                Size = alpha,
                Power = power,
            };

            analysis.ComputeEffect();

            return analysis;
        }
        /// <summary>
        ///   Estimates the number of samples necessary to attain the
        ///   required power level for the given effect size.
        /// </summary>
        /// 
        /// <param name="delta">The minimum detectable difference.</param>
        /// <param name="standardDeviation">The difference standard deviation.</param>
        /// <param name="power">The desired power level. Default is 0.8.</param>
        /// <param name="alpha">The desired significance level. Default is 0.05.</param>
        /// <param name="hypothesis">The alternative hypothesis (research hypothesis) to be tested.</param>
        /// <param name="proportion">The proportion of observations in the second group
        /// when compared to the first group. A proportion of 2:1 results in twice more
        /// samples in the second group than in the first. Default is 1.</param>
        /// 
        /// <returns>The required number of samples.</returns>
        /// 
        public static TwoSampleZTestPowerAnalysis GetSampleSize(double delta,
            double standardDeviation = 1, double proportion = 1.0, double power = 0.8, double alpha = 0.05,
            TwoSampleHypothesis hypothesis = TwoSampleHypothesis.ValuesAreDifferent)
        {
            var analysis = new TwoSampleZTestPowerAnalysis(hypothesis)
            {
                Effect = (delta) / standardDeviation,
                Size = alpha,
                Power = power,
            };

            analysis.ComputeSamples(proportion);

            return analysis;
        }