예제 #1
0
        private void NCSSLinRegSlopeDeviation()
        {
            //NCSS.com Confidence intervals for linear regression slope

            var res        = Residuals;
            var sumsquared = LRM.SumOfSquared(res);
            var s          = Math.Sqrt(sumsquared / (XValues.Length - 2));

            var se = s / Math.Sqrt(LRM.SumOfSquared(XValues));
        }
예제 #2
0
        /// <summary>
        /// Get fit errors. Returns Tuple(slope error, intercept error).
        /// </summary>
        /// <returns> </returns>
        private Tuple <double, double> GetFittingErrors()
        {
            if (!IsFitted)
            {
                return(new Tuple <double, double>(0, 0));
            }

            var res            = Residuals;
            var sumofsquared   = LRM.SumOfSquared(res);
            var ssd            = LRM.ArraySumSquareDeviation(XValues);
            var oneoverxlength = 1f / (XValues.Length - 2);
            var se_slope       = Math.Sqrt(oneoverxlength * sumofsquared / ssd);

            var se_intercept = se_slope * Math.Sqrt(1f / XValues.Length * LRM.SumOfSquared(XValues));

            return(new Tuple <double, double>(se_slope, se_intercept));
        }