Index: /branches/StatisticalTesting/HeuristicLab.Analysis.Statistics/3.3/SampleSizeDetermination.cs
===================================================================
--- /branches/StatisticalTesting/HeuristicLab.Analysis.Statistics/3.3/SampleSizeDetermination.cs	(revision 10015)
+++ /branches/StatisticalTesting/HeuristicLab.Analysis.Statistics/3.3/SampleSizeDetermination.cs	(revision 10016)
@@ -27,18 +27,21 @@
   public class SampleSizeDetermination {
     /// <summary>
-    /// Determines for a given sample the sample size by estimating the means. 
+    /// Determines for a given sample the required sample size as described in 
+    /// Göran Kauermann, Helmut Küchenhoff: Stichproben: Methoden und praktische Umsetzung mit R, chapter 2.27. 
     /// </summary>
     /// <param name="samples">The pilot sample.</param>
-    /// <param name="e">Precision. </param>
     /// <param name="conf">Confidence Interval.</param>
     /// <returns>Number of required samples for the given confidence interval and precision. </returns>
-    public static int DetermineSampleSizeByEstimatingMean(double[] samples, double e, double conf = 0.95) {
-      if (e < 0) throw new ArgumentException("e needs to be a positive number.");
+    public static int DetermineSampleSizeByEstimatingMean(double[] samples, double conf = 0.95) {
       if (conf < 0 || conf > 1) throw new ArgumentException("The confidence Interval must be between zero and one.");
-      double result = 0;
 
-      double var = samples.StandardDeviation();
-      double n = alglib.invnormaldistribution((conf + 1) / 2);
-      result = Math.Pow(n, 2) * Math.Pow(var, 2) / Math.Pow(e, 2);
+      var confInterval = samples.ConfidenceIntervals(0.95);
+      double e = (confInterval.Item2 - confInterval.Item1) / 2;
+      double s = samples.StandardDeviation();
+      double z = alglib.invnormaldistribution((conf + 1) / 2);
+      double n = samples.Count();
+
+      double result = Math.Pow(s, 2) / ((Math.Pow(e, 2) / Math.Pow(z, 2)) + (Math.Pow(s, 2) / n));
+
       result = Math.Ceiling(result);
       if (result > int.MaxValue)
Index: /branches/StatisticalTesting/HeuristicLab.Analysis.Statistics/3.3/SampleSizeInfluenceView.Designer.cs
===================================================================
--- /branches/StatisticalTesting/HeuristicLab.Analysis.Statistics/3.3/SampleSizeInfluenceView.Designer.cs	(revision 10015)
+++ /branches/StatisticalTesting/HeuristicLab.Analysis.Statistics/3.3/SampleSizeInfluenceView.Designer.cs	(revision 10016)
@@ -55,4 +55,5 @@
       this.noRunsLabel = new System.Windows.Forms.Label();
       this.splitContainer = new System.Windows.Forms.SplitContainer();
+      this.sampleSizeTextBox = new System.Windows.Forms.TextBox();
       this.xAxisComboBox = new System.Windows.Forms.TextBox();
       this.defineSampleSizeButton = new System.Windows.Forms.Button();
@@ -61,4 +62,5 @@
       this.statisticsMatrixView = new HeuristicLab.Data.Views.StringConvertibleMatrixView();
       this.tooltip = new System.Windows.Forms.ToolTip(this.components);
+      this.label1 = new System.Windows.Forms.Label();
       ((System.ComponentModel.ISupportInitialize)(this.chart)).BeginInit();
       ((System.ComponentModel.ISupportInitialize)(this.splitContainer)).BeginInit();
@@ -140,4 +142,5 @@
       // splitContainer.Panel1
       // 
+      this.splitContainer.Panel1.Controls.Add(this.sampleSizeTextBox);
       this.splitContainer.Panel1.Controls.Add(this.xAxisComboBox);
       this.splitContainer.Panel1.Controls.Add(this.defineSampleSizeButton);
@@ -155,4 +158,14 @@
       this.splitContainer.SplitterDistance = 277;
       this.splitContainer.TabIndex = 23;
+      // 
+      // sampleSizeTextBox
+      // 
+      this.sampleSizeTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 
+            | System.Windows.Forms.AnchorStyles.Right)));
+      this.sampleSizeTextBox.Location = new System.Drawing.Point(401, 3);
+      this.sampleSizeTextBox.Name = "sampleSizeTextBox";
+      this.sampleSizeTextBox.ReadOnly = true;
+      this.sampleSizeTextBox.Size = new System.Drawing.Size(139, 20);
+      this.sampleSizeTextBox.TabIndex = 26;
       // 
       // xAxisComboBox
@@ -217,4 +230,13 @@
       this.statisticsMatrixView.TabIndex = 0;
       // 
+      // label1
+      // 
+      this.label1.AutoSize = true;
+      this.label1.Location = new System.Drawing.Point(251, 6);
+      this.label1.Name = "label1";
+      this.label1.Size = new System.Drawing.Size(143, 13);
+      this.label1.TabIndex = 26;
+      this.label1.Text = "Recommended Sample Size:";
+      // 
       // SampleSizeInfluenceView
       // 
@@ -222,4 +244,5 @@
       this.BackColor = System.Drawing.SystemColors.Window;
       this.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
+      this.Controls.Add(this.label1);
       this.Controls.Add(this.splitContainer);
       this.Name = "SampleSizeInfluenceView";
@@ -233,4 +256,5 @@
       this.statisticsGroupBox.ResumeLayout(false);
       this.ResumeLayout(false);
+      this.PerformLayout();
 
     }
@@ -250,4 +274,6 @@
     private System.Windows.Forms.Button defineSampleSizeButton;
     private System.Windows.Forms.TextBox xAxisComboBox;
+    private System.Windows.Forms.Label label1;
+    private System.Windows.Forms.TextBox sampleSizeTextBox;
   }
 }
Index: /branches/StatisticalTesting/HeuristicLab.Analysis.Statistics/3.3/SampleSizeInfluenceView.cs
===================================================================
--- /branches/StatisticalTesting/HeuristicLab.Analysis.Statistics/3.3/SampleSizeInfluenceView.cs	(revision 10015)
+++ /branches/StatisticalTesting/HeuristicLab.Analysis.Statistics/3.3/SampleSizeInfluenceView.cs	(revision 10016)
@@ -238,6 +238,24 @@
 
         UpdateAxisLabels();
+        if (groupSizes.Any())
+          AddSampleSizeText();
+      } else {
+        sampleSizeTextBox.Text = string.Empty;
       }
       UpdateNoRunsVisibleLabel();
+    }
+
+    private void AddSampleSizeText() {
+      sampleSizeTextBox.Text = string.Empty;
+      var usableRuns = Content.Where(r => r.Visible).ToList();
+
+      if (!yAxisComboBox.DroppedDown)
+        this.yAxisValue = (string)yAxisComboBox.SelectedItem;
+
+      List<double?> yValue = usableRuns.Select(x => GetValue(x, this.yAxisValue)).ToList();
+      if (yValue.Any(x => !x.HasValue)) return;
+
+      double y = SampleSizeDetermination.DetermineSampleSizeByEstimatingMean(yValue.Select(x => x.Value).ToArray());
+      sampleSizeTextBox.Text = y.ToString();
     }
 
@@ -302,4 +320,7 @@
         Series series = seriesCache.ElementAt(i).Value;
         double[] seriesValues = series.Points.Select(p => p.YValues[0]).OrderBy(d => d).ToArray();
+        Tuple<double, double> confIntervals = new Tuple<double, double>(double.NaN, double.NaN);
+        if (seriesValues.Count() > 1)
+          confIntervals = seriesValues.ConfidenceIntervals(0.95);
         matrix[0, i] = seriesValues.Length;
         matrix[1, i] = seriesValues.Min();
@@ -311,6 +332,6 @@
         matrix[7, i] = seriesValues.Percentile(0.25);
         matrix[8, i] = seriesValues.Percentile(0.75);
-        matrix[9, i] = seriesValues.ConfidenceIntervals(0.95).Item1;
-        matrix[10, i] = seriesValues.ConfidenceIntervals(0.95).Item2;
+        matrix[9, i] = confIntervals.Item1;
+        matrix[10, i] = confIntervals.Item2;
       }
       statisticsMatrixView.Content = matrix;
