public AnalysisContext(
     ParametersPack args,
     AnalysisLaunchContext launchContext,
     FileInfo outputExcelFile,
     PhaseOnePartOneAnalysisKind phaseOnePartOne,
     PhaseOnePartTwoAnalysisKind phaseOnePartTwo,
     PhaseTwoAnalysisKind phaseTwo,
     GoodnessOfFitKind goodnessOfFit)
 {
     Args            = args.ThrowIfNull(nameof(args));
     LaunchContext   = launchContext.ThrowIfNull(nameof(launchContext));
     OutputExcelFile = outputExcelFile.ThrowIfNull(nameof(outputExcelFile));
     PhaseOnePartOne = phaseOnePartOne.ThrowIfNull(nameof(phaseOnePartOne));
     PhaseOnePartTwo = phaseOnePartTwo.ThrowIfNull(nameof(phaseOnePartTwo));
     PhaseTwo        = phaseTwo.ThrowIfNull(nameof(phaseTwo));
     GoodnessOfFit   = goodnessOfFit.ThrowIfNull(nameof(goodnessOfFit));
 }
        internal static IAnalysisPhaseTwo CreateAnalysisPhaseTwo(
            PhaseTwoAnalysisKind phaseTwo, IFunctionSelector goodnessOfFit, ParametersPack args)
        {
            phaseTwo.ThrowIfNull(nameof(phaseTwo));

            if (PhaseTwoAnalysisKind.NormalDistribution.Equals(phaseTwo))
            {
                // TODO: add formulas for solution based on Sturges's formula.
                throw new NotImplementedException(
                          "Normal distribution analysis for phase 2 is not implemented."
                          );
            }
            if (PhaseTwoAnalysisKind.BetaDistribution.Equals(phaseTwo))
            {
                var regression = Regression.Create(goodnessOfFit);
                return(new BetaDistributionAnalysisPhaseTwo(args, regression));
            }

            throw new ArgumentOutOfRangeException(
                      nameof(phaseTwo), phaseTwo,
                      $"Unknown analysis kind for phase 2 value: {phaseTwo.ToLogString()}"
                      );
        }