// TODO: allow to specify function provider too (need to add new option in UI and context). public static Regression Create(IFunctionSelector goodnessOfFit) { return(new Regression( functionProvider: new FunctionProviderSimilarToExcel(), functionSelector: goodnessOfFit )); }
private static ExcelContextForPhaseTwo <IAnalysisPhaseTwo> CreateExcelContext( AnalysisContext context) { IFunctionSelector goonessOfFit = AnalysisHelper.CreateGoodnessOfFit( context.GoodnessOfFit ); Func <ParametersPack, IAnalysisPhaseTwo> analysisFactory = args => AnalysisHelper.CreateAnalysisPhaseTwo(context.PhaseTwo, goonessOfFit, args); return(ExcelContextForPhaseTwo <IAnalysisPhaseTwo> .CreateFor( analysisContext : context, sheetName : ExcelHelper.CreateSheetName(PhaseNumber), analysisFactory : analysisFactory )); }
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()}" ); }
public Regression(IFunctionProvider functionProvider, IFunctionSelector functionSelector) { _functionProvider = functionProvider.ThrowIfNull(nameof(functionProvider)); _functionSelector = functionSelector.ThrowIfNull(nameof(functionSelector)); }