public NamedVariableLeastSquaresRegressionResult(IList <string> independentVariableNames, LeastSquaresRegressionResult result) : base(result) { if (independentVariableNames == null) { throw new System.ArgumentException("List of independent variable names was null"); } _independentVariableNames = new List <>(); if (result.hasIntercept()) { if (independentVariableNames.Count != result.Betas.Length - 1) { throw new System.ArgumentException("Length of variable name array did not match number of results in the regression"); } _independentVariableNames.Add(INTERCEPT_STRING); } else { if (independentVariableNames.Count != result.Betas.Length) { throw new System.ArgumentException("Length of variable name array did not match number of results in the regression"); } } ((IList <string>)_independentVariableNames).AddRange(independentVariableNames); _result = result; }
public LeastSquaresRegressionResult(LeastSquaresRegressionResult result) { ArgChecker.notNull(result, "regression result"); _betas = result.Betas; _residuals = result.Residuals; _meanSquareError = result.MeanSquareError; _standardErrorOfBeta = result.StandardErrorOfBetas; _rSquared = result.RSquared; _rSquaredAdjusted = result.AdjustedRSquared; _tStats = result.TStatistics; _pValues = result.PValues; _hasIntercept = result.hasIntercept(); }