public override string ToString() { if (count < 1) { return(name + ": <no data>"); } if (times) { double total_sec = total * 1.0 / Stopwatch.Frequency; if (count == 1) { return(name + ": " + total_sec.ToString()); } double average_sec = total_sec / count; double sumsq_sec = sumsq / Stopwatch.Frequency / Stopwatch.Frequency; double variance = (sumsq_sec - total_sec * total_sec / count) / (count - 1); double stdev = Math.Sqrt(variance); double conf95 = StudentT.InvCDF(0, stdev, count - 1, 0.975) / Math.Sqrt(count); return(string.Format("Aggregate {0}: avg_usec {1} conf95plusorminus {2} stdev {3} count {4} sum {5}", name, average_sec * Math.Pow(10, 6), conf95 * Math.Pow(10, 6), stdev * Math.Pow(10, 6), count, total_sec * Math.Pow(10, 6))); } else { if (count == 1) { return(total.ToString()); } double average = total * 1.0 / count; double variance = (sumsq - (total * 1.0 * total) / count) / (count - 1); double stdev = Math.Sqrt(variance); double conf95 = StudentT.InvCDF(0, stdev, count - 1, 0.975) / Math.Sqrt(count); return(string.Format("Aggregate {0}: avg_usec {1} conf95plusorminus {2} stdev {3} count {4} sum {5}", name, average * Math.Pow(10, 6), conf95 * Math.Pow(10, 6), stdev * Math.Pow(10, 6), count, total * Math.Pow(10, 6))); } }
public void ValidateInverseCumulativeDistribution(double location, double scale, double dof, double x, double p) { var dist = new StudentT(location, scale, dof); Assert.That(dist.InverseCumulativeDistribution(p), Is.EqualTo(x).Within(1e-6)); Assert.That(StudentT.InvCDF(location, scale, dof, p), Is.EqualTo(x).Within(1e-6)); }
/// <summary> /// Tau distribucija (razdioba) /// </summary> /// <param name="alfa">Nivo signifikantnosti (znacajnosti) -> 1 > alfa > 0</param> /// <param name="f">Stupanj slobode</param> /// <returns>double</returns> /// <remarks> /// <para/>Distribucija interno studentiziranih mjerenja /// <para/>Popravci i njihove standardne su korelirani /// <para/>Allan J. Pope 1976. /// </remarks> public static double Tau(double alfa, int f) { double t = StudentT.InvCDF(0, 1, f - 1, 1 - alfa / 2); double tau = t * Math.Sqrt(f) / Math.Sqrt(f - 1 + Math.Pow(t, 2)); return(tau); }
public double[] ConfidenceIntervalSimulationTime(double confidence) { confidence = 1 - ((1 - confidence) / 2); double[] interval = new double[2]; double avg = _simulationTimeCumulative / _iterator; double standardDeviation = Math.Sqrt((_simulationTimePower / _iterator) - Math.Pow(avg, 2)); double value = 0; if (_iterator < 30) { value = StudentT.InvCDF(0.0, 1.0, _iterator, confidence); } else { value = Normal.InvCDF(0, 1, confidence); } interval[0] = avg - (value * standardDeviation / Math.Sqrt((_iterator - 1))); interval[1] = avg + (value * standardDeviation / Math.Sqrt((_iterator - 1))); return(interval); }
public static double GetCriticalValue(double significanceLevel, double df) { return(StudentT.InvCDF(0.0, 1.0, df, 1.0 - significanceLevel / 2.0)); }
public static double TInv(double probability, int degreesFreedom) { return(-StudentT.InvCDF(0d, 1d, degreesFreedom, probability / 2)); }
/// <summary> /// Inverzna Student (T) distribucija (razdioba) /// </summary> /// <param name="alfa">Nivo signifikantnosti (znacajnosti) -> 1 > alfa > 0</param> /// <param name="f">Stupanj slobode</param> /// <returns>double</returns> public static double Student(double alfa, int f) { return(StudentT.InvCDF(0, 1, f, 1 - alfa)); }
public static double T_INV_2T(double p, double nu) { return(StudentT.InvCDF(location: 0.0, scale: 1.0, freedom: nu, p: 1.0 - p / 2.0)); }
private double ConfidenceInterval95(List <double> l, double standardError) { return(-StudentT.InvCDF(0, 1, l.Count - 1, 0.025) * standardError); }